mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-28 10:31:20 -08:00
feat: update changelog with Parcel to Vite refactor
feat: add danmuku plugin documentation and i18n setup guide - Created a new documentation file for the danmuku plugin with code examples. - Added a comprehensive guide for language settings (i18n) including default languages, importing languages, adding new languages, and modifying existing languages. - Included code snippets for initializing the Artplayer with different language settings. Add internationalization support for multiple languages in Artplayer - Introduced Arabic (ar), Czech (cs), Spanish (es), Persian (fa), French (fr), Indonesian (id), Polish (pl), Russian (ru), Turkish (tr), Vietnamese (vi), and Traditional Chinese (zh-tw) translations. - Created corresponding JavaScript and ES module files for each language containing translated strings for player controls and settings. - Added a new documentation file for language settings in the project. feat: add initial implementation of start option page with interactive code execution buttons feat: add danmuku plugin documentation and i18n setup guide - Created a new documentation file for the danmuku plugin, providing code examples for usage. - Added a comprehensive guide for language settings, including default languages, importing languages, adding new languages, and modifying existing languages. - Included code snippets for initializing the Artplayer with different language settings and importing language files. refactor: update danmuku worker implementation and remove unused i18n files - Changed the way the Danmuku class creates a Web Worker by using a worker loader instead of creating a blob. - Removed Arabic, Czech, Spanish, Persian, French, Indonesian, Polish, Russian, Turkish, Vietnamese, and Traditional Chinese i18n files as they are no longer needed. - Updated the Vite build configuration to disable banners for inline workers and added a plugin to remove worker banners from generated code. feat: add danmuku plugin and i18n setup documentation - Created a new documentation file for the danmuku plugin, providing code examples for usage. - Added a new documentation file for language settings (i18n), detailing how to set default languages, import languages, and add new languages. - Included code snippets for initializing the Artplayer with different language settings and examples for modifying existing languages. feat: add danmuku plugin and i18n setup documentation - Created a new documentation file for the danmuku plugin with code examples. - Added a new documentation file for language settings (i18n) including import instructions and examples for setting default and custom languages. - Updated the i18n documentation to include details on adding and modifying languages. feat: add danmuku plugin and i18n setup documentation - Created a new JavaScript file for the danmuku plugin documentation with multiple code execution buttons. - Added a new JavaScript file for i18n (internationalization) setup documentation, including instructions for language settings, importing languages, and modifying language options. - Included examples for setting default languages and adding new languages in the i18n documentation. Refactor code structure for improved readability and maintainability
This commit is contained in:
1 parent
ddb78cf850
commit
699bf09577
397 files changed
+99776
-8638
No files matched your search
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-ads.js v2.0.0
|
||||
* artplayer-plugin-ads.js v2.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,l,i){var r="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},a="function"==typeof r[l]&&r[l],o=a.i||{},d=a.cache||{},u="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,n){if(!d[t]){if(!e[t]){if(i[t])return i[t];var o="function"==typeof r[l]&&r[l];if(!n&&o)return o(t,!0);if(a)return a(t,!0);if(u&&"string"==typeof t)return u(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}y.resolve=function(n){var l=e[t][1][n];return null!=l?l:n},y.cache={};var c=d[t]=new p.Module(t);e[t][0].call(c.exports,y,c,c.exports,r)}return d[t].exports;function y(e){var t=y.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=p(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 p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=u,this.exports={}},p.modules=e,p.cache=d,p.parent=a,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=o,p.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(p,"root",{get:function(){return r[l]}}),r[l]=p;for(var s=0;s<t.length;s++)p(t[s]);if(n){var c=p(n);"object"==typeof exports&&"u">typeof module?module.exports=c:"function"==typeof define&&define.amd&&define(function(){return c})}}({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,'<div class="artplayer-plugin-ads"></div>'),y=s(t.template.$ads,e.video?`<video class="artplayer-plugin-ads-video" src="${e.video}" loop playsInline></video>`:`<div class="artplayer-plugin-ads-html">${e.html}</div>`),x=s(t.template.$ads,'<div class="artplayer-plugin-ads-loading"></div>'),s(x,d),g=p(".artplayer-plugin-ads-close",f=s(t.template.$ads,`<div class="artplayer-plugin-ads-timer"><div class="artplayer-plugin-ads-close">${e.playDuration<=0?e.i18n.close:P(e.playDuration,e.i18n.canBeClosed)}</div><div class="artplayer-plugin-ads-countdown">${P(e.totalDuration,e.i18n.countdown)}</div></div>`)),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,`<div class="artplayer-plugin-ads-control"><div class="artplayer-plugin-ads-detail">${e.i18n.detail}</div><div class="artplayer-plugin-ads-muted"></div><div class="artplayer-plugin-ads-fullscreen"></div></div>`)),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.Line truncated
|
||||
!function(e,l){"object"===typeof exports&&"undefined"!==typeof module?module.exports=l():"function"==typeof define&&define.amd?(t.ArtplayerPluginAds=l(),define(function(){return t.ArtplayerPluginAds})):(e="undefined"!==typeof globalThis?globalThis:e||self).ArtplayerPluginAds=l()}(this,function(){"use strict";function e(l){return n=>{!function(l){const{version:n,utils:{errorHandle:i}}=l.constructor,a=n.split(".").map(Number);i(a[0]+a[1]/100>=5,`Artplayer.js@${n} is not compatible the artplayerPluginAds@${e.version}. Please update it to version Artplayer.js@5.x.x`)}(n);const{template:{$player:i},icons:{volume:a,volumeClose:t,fullscreenOn:r,fullscreenOff:d,loading:o},constructor:{validator:s,utils:{query:p,append:u,setStyle:c}}}=n;l=s({html:"",video:"",url:"",playDuration:5,totalDuration:10,muted:!1,i18n:{close:"\u5173\u95ed\u5e7f\u544a",countdown:"%s\u79d2",detail:"\u67e5\u770b\u8be6\u60c5",canBeClosed:"%s\u79d2\u540e\u53ef\u5173\u95ed\u5e7f\u544a"},...l},{html:"?string",video:"?string",url:"?string",playDuration:"number",totalDuration:"number",muted:"?boolean",i18n:{close:"string",countdown:"string",detail:"string",canBeClosed:"string"}});let y=null,g=null,f=null,m=null,v=null,x=null,h=0,w=null,b=!1,$=!1,k=!1;function D(e,l){return l.replace("%s",e)}function A(){b=!0,n.play(),l.video&&y.pause(),c(n.template.$ads,"display","none"),n.emit("artplayerPluginAds:skip",l)}function P(){b||(w=setTimeout(()=>{h+=1;const e=l.playDuration-h;e>=1?f.innerHTML=D(e,l.i18n.canBeClosed):(f.innerHTML=l.i18n.close,k||(k=!0)),m.innerHTML=D(l.totalDuration-h,l.i18n.countdown),h>=l.totalDuration?A():P()},1e3))}function C(){b||clearTimeout(w)}function T(){$||($=!0,function(){n.template.$ads=u(i,'<div class="artplayer-plugin-ads"></div>'),y=u(n.template.$ads,l.video?`<video class="artplayer-plugin-ads-video" src="${l.video}" loop playsInline></video>`:`<div class="artplayer-plugin-ads-html">${l.html}</div>`),x=u(n.template.$ads,'<div class="artplayer-plugin-ads-loading"></div>'),u(x,o),g=u(n.template.$ads,`<div class="artplayer-plugin-ads-timer">\n <div class="artplayer-plugin-ads-close">${l.playDuration<=0?l.i18n.close:D(l.playDuration,l.i18n.canBeClosed)}</div>\n <div class="artplayer-plugin-ads-countdown">${D(l.totalDuration,l.i18n.countdown)}</div>\n </div>`),f=p(".artplayer-plugin-ads-close",g),m=p(".artplayer-plugin-ads-countdown",g),l.playDuration>=l.totalDuration&&c(f,"display","none"),n.proxy(f,"click",()=>{k&&A()}),v=u(n.template.$ads,`<div class="artplayer-plugin-ads-control">\n <div class="artplayer-plugin-ads-detail">${l.i18n.detail}</div>\n <div class="artplayer-plugin-ads-muted"></div>\n <div class="artplayer-plugin-ads-fullscreen"></div>\n </div>`);const e=p(".artplayer-plugin-ads-detail",v),s=p(".artplayer-plugin-ads-muted",v),h=p(".artplayer-plugin-ads-fullscreen",v);if(l.url?n.proxy(e,"click",()=>{window.open(l.url),n.emit("artplayerPluginAds:click",l)}):c(e,"display","none"),l.video){const e=u(s,a),i=u(s,t);c(i,"display","none"),l.muted&&(y.muted=!0,c(e,"display","none"),c(i,"display","inline-flex")),n.proxy(s,"click",()=>{y.muted=!y.muted,y.muted?(c(e,"display","none"),c(i,"display","inline-flex")):(c(e,"display","inline-flex"),c(i,"display","none"))})}else c(s,"display","none");const w=u(h,r),b=u(h,d);c(b,"display","none"),n.proxy(h,"click",()=>{n.fullscreen=!n.fullscreen,n.fullscreen?(c(w,"display","inline-flex"),c(b,"display","none")):(c(w,"display","none"),c(b,"display","inline-flex"))}),n.proxy(y,"click",()=>{l.url&&window.open(l.url),n.emit("artplayerPluginAds:click",l)})}(),n.pause(),l.video?(n.proxy(y,"error",A),n.proxy(y,"loadedmetadata",()=>{P(),y.play(),c(g,"display","flex"),c(v,"display","flex"),c(x,"display","none")})):(P(),c(g,"display","flex"),c(v,"display","flex"),c(x,"display","none")),n.on("document:visibilitychange",()=>{document.hidden?C():P()}))}return n.on("ready",()=>{n.once("play",T),n.once("video:playing",T)}),{name:"artplayerPluginAds",skip:A,pause:C,play:P}}}if("undefined"!==typeof document&&!document.getElementById("artplayer-plugin-ads")){const e=document.createElement("style");e.id="artplayer-plugin-ads",e.textContent=".artplayer-plugin-ads{position:absolute;z-index:150;inset:0;width:100%;height:100%;overflow:hidden;font-size:13px;line-height:1;color:#fff;background-color:#000}.artplayer-plugin-ads .artplayer-plugin-ads-html{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.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{display:flex;align-items:center;background-color:#00000080;border-radius:15px;margin-left:5px;padding:5px 10px;cursor:pointer}.artplayer-plugin-ads .artplayer-plugin-ads-control{display:none;position:absolute;bottom:10px;right:10px}.artplLine truncated
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-ads.js v2.0.0
|
||||
* artplayer-plugin-ads.js v2.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,n,t,r,l){var i="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},a="function"==typeof i[r]&&i[r],o=a.i||{},u=a.cache||{},s="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(n,t){if(!u[n]){if(!e[n]){if(l[n])return l[n];var o="function"==typeof i[r]&&i[r];if(!t&&o)return o(n,!0);if(a)return a(n,!0);if(s&&"string"==typeof n)return s(n);var d=Error("Cannot find module '"+n+"'");throw d.code="MODULE_NOT_FOUND",d}f.resolve=function(t){var r=e[n][1][t];return null!=r?r:t},f.cache={};var c=u[n]=new p.Module(n);e[n][0].call(c.exports,f,c,c.exports,i)}return u[n].exports;function f(e){var n=f.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=p(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 p(n)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=s,this.exports={}},p.modules=e,p.cache=u,p.parent=a,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=o,p.register=function(n,t){e[n]=[function(e,n){n.exports=t},{}]},Object.defineProperty(p,"root",{get:function(){return i[r]}}),i[r]=p;for(var d=0;d<n.length;d++)p(n[d]);if(t){var c=p(t);"object"==typeof exports&&"u">typeof module?module.exports=c:"function"==typeof define&&define.amd&&define(function(){return c})}}({"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,'<div class="artplayer-plugin-ads"></div>'),x=b(n.template.$ads,e.video?'<video class="artplayer-plugin-ads-video" src="'.concat(e.video,'" loop playsInline></video>'):'<div class="artplayer-plugin-ads-html">'.concat(e.html,"</div>")),_=b(n.template.$ads,'<div class="artplayer-plugin-ads-loading"></div>'),b(_,f),j=v(".artplayer-plugin-ads-close",w=b(n.template.$ads,'<div class="artplayer-plugin-ads-timer">\n<div class="artplayer-plugin-ads-close">'.concat(e.playDuration<=0?e.i18n.close:E(e.playDuration,e.i18n.canBeClosed),'</div>\n<div class="artplayer-plugin-ads-countdown">').concat(E(e.totalDuration,e.i18n.countdown),"</div>\n</div>"))),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,'<div class="artplayer-plugin-ads-control">\n<div class="artplayer-plugin-ads-detail">'.concat(e.i18n.detail,'</div>\n<div class="artplayer-plugin-ads-muted"></div>\n<div class="artplayer-plugin-ads-fullscreen"></div>\n</div>'))),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,"cLine truncated
|
||||
!function(e,l){"object"===typeof exports&&"undefined"!==typeof module?module.exports=l():"function"==typeof define&&define.amd?(t.ArtplayerPluginAds=l(),define(function(){return t.ArtplayerPluginAds})):(e="undefined"!==typeof globalThis?globalThis:e||self).ArtplayerPluginAds=l()}(this,function(){"use strict";var e=Object.defineProperty,l=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,i=(l,n,a)=>n in l?e(l,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):l[n]=a;function t(e){return r=>{!function(e){const{version:l,utils:{errorHandle:n}}=e.constructor,a=l.split(".").map(Number);n(a[0]+a[1]/100>=5,`Artplayer.js@${l} is not compatible the artplayerPluginAds@${t.version}. Please update it to version Artplayer.js@5.x.x`)}(r);const{template:{$player:o},icons:{volume:d,volumeClose:p,fullscreenOn:s,fullscreenOff:u,loading:c},constructor:{validator:y,utils:{query:g,append:f,setStyle:m}}}=r;e=y(((e,t)=>{for(var r in t||(t={}))n.call(t,r)&&i(e,r,t[r]);if(l)for(var r of l(t))a.call(t,r)&&i(e,r,t[r]);return e})({html:"",video:"",url:"",playDuration:5,totalDuration:10,muted:!1,i18n:{close:"\u5173\u95ed\u5e7f\u544a",countdown:"%s\u79d2",detail:"\u67e5\u770b\u8be6\u60c5",canBeClosed:"%s\u79d2\u540e\u53ef\u5173\u95ed\u5e7f\u544a"}},e),{html:"?string",video:"?string",url:"?string",playDuration:"number",totalDuration:"number",muted:"?boolean",i18n:{close:"string",countdown:"string",detail:"string",canBeClosed:"string"}});let v=null,x=null,h=null,b=null,w=null,$=null,k=0,D=null,P=!1,A=!1,j=!1;function O(e,l){return l.replace("%s",e)}function C(){P=!0,r.play(),e.video&&v.pause(),m(r.template.$ads,"display","none"),r.emit("artplayerPluginAds:skip",e)}function T(){P||(D=setTimeout(()=>{k+=1;const l=e.playDuration-k;l>=1?h.innerHTML=O(l,e.i18n.canBeClosed):(h.innerHTML=e.i18n.close,j||(j=!0)),b.innerHTML=O(e.totalDuration-k,e.i18n.countdown),k>=e.totalDuration?C():T()},1e3))}function B(){P||clearTimeout(D)}function H(){A||(A=!0,function(){r.template.$ads=f(o,'<div class="artplayer-plugin-ads"></div>'),v=f(r.template.$ads,e.video?`<video class="artplayer-plugin-ads-video" src="${e.video}" loop playsInline></video>`:`<div class="artplayer-plugin-ads-html">${e.html}</div>`),$=f(r.template.$ads,'<div class="artplayer-plugin-ads-loading"></div>'),f($,c),x=f(r.template.$ads,`<div class="artplayer-plugin-ads-timer">\n <div class="artplayer-plugin-ads-close">${e.playDuration<=0?e.i18n.close:O(e.playDuration,e.i18n.canBeClosed)}</div>\n <div class="artplayer-plugin-ads-countdown">${O(e.totalDuration,e.i18n.countdown)}</div>\n </div>`),h=g(".artplayer-plugin-ads-close",x),b=g(".artplayer-plugin-ads-countdown",x),e.playDuration>=e.totalDuration&&m(h,"display","none"),r.proxy(h,"click",()=>{j&&C()}),w=f(r.template.$ads,`<div class="artplayer-plugin-ads-control">\n <div class="artplayer-plugin-ads-detail">${e.i18n.detail}</div>\n <div class="artplayer-plugin-ads-muted"></div>\n <div class="artplayer-plugin-ads-fullscreen"></div>\n </div>`);const l=g(".artplayer-plugin-ads-detail",w),n=g(".artplayer-plugin-ads-muted",w),a=g(".artplayer-plugin-ads-fullscreen",w);if(e.url?r.proxy(l,"click",()=>{window.open(e.url),r.emit("artplayerPluginAds:click",e)}):m(l,"display","none"),e.video){const l=f(n,d),a=f(n,p);m(a,"display","none"),e.muted&&(v.muted=!0,m(l,"display","none"),m(a,"display","inline-flex")),r.proxy(n,"click",()=>{v.muted=!v.muted,v.muted?(m(l,"display","none"),m(a,"display","inline-flex")):(m(l,"display","inline-flex"),m(a,"display","none"))})}else m(n,"display","none");const i=f(a,s),t=f(a,u);m(t,"display","none"),r.proxy(a,"click",()=>{r.fullscreen=!r.fullscreen,r.fullscreen?(m(i,"display","inline-flex"),m(t,"display","none")):(m(i,"display","none"),m(t,"display","inline-flex"))}),r.proxy(v,"click",()=>{e.url&&window.open(e.url),r.emit("artplayerPluginAds:click",e)})}(),r.pause(),e.video?(r.proxy(v,"error",C),r.proxy(v,"loadedmetadata",()=>{T(),v.play(),m(x,"display","flex"),m(w,"display","flex"),m($,"display","none")})):(T(),m(x,"display","flex"),m(w,"display","flex"),m($,"display","none")),r.on("document:visibilitychange",()=>{document.hidden?B():T()}))}return r.on("ready",()=>{r.once("play",H),r.once("video:playing",H)}),{name:"artplayerPluginAds",skip:C,pause:B,play:T}}}if("undefined"!==typeof document&&!document.getElementById("artplayer-plugin-ads")){const e=document.createElement("style");e.id="artplayer-plugin-ads",e.textContent=".artplayer-plugin-ads{position:absolute;z-index:150;inset:0;width:100%;height:100%;overflow:hidden;font-size:13px;line-height:1;color:#fff;background-color:#000}.artplayer-plugin-ads .artplayer-plugin-ads-html{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.artplayer-plugin-ads .artplayer-plugin-ads-video{width:100%;height:100%}.artplayer-plugin-ads .artplayer-plugin-ads-timer{display:noneLine truncated
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-ads.js v2.0.0
|
||||
* artplayer-plugin-ads.js v2.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,l,n,i){var r="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},a="function"==typeof r[n]&&r[n],o=a.i||{},d=a.cache||{},u="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,l){if(!d[t]){if(!e[t]){if(i[t])return i[t];var o="function"==typeof r[n]&&r[n];if(!l&&o)return o(t,!0);if(a)return a(t,!0);if(u&&"string"==typeof t)return u(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}y.resolve=function(l){var n=e[t][1][l];return null!=n?n:l},y.cache={};var c=d[t]=new p.Module(t);e[t][0].call(c.exports,y,c,c.exports,r)}return d[t].exports;function y(e){var t=y.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=p(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 p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=u,this.exports={}},p.modules=e,p.cache=d,p.parent=a,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=o,p.register=function(t,l){e[t]=[function(e,t){t.exports=l},{}]},Object.defineProperty(p,"root",{get:function(){return r[n]}}),r[n]=p;for(var s=0;s<t.length;s++)p(t[s]);if(l){var c=p(l);"object"==typeof exports&&"u">typeof module?module.exports=c:"function"==typeof define&&define.amd&&define(function(){return c})}}({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,'<div class="artplayer-plugin-ads"></div>'),y=s(t.template.$ads,e.video?`<video class="artplayer-plugin-ads-video" src="${e.video}" loop playsInline></video>`:`<div class="artplayer-plugin-ads-html">${e.html}</div>`),x=s(t.template.$ads,'<div class="artplayer-plugin-ads-loading"></div>'),s(x,d),g=p(".artplayer-plugin-ads-close",f=s(t.template.$ads,`<div class="artplayer-plugin-ads-timer"><div class="artplayer-plugin-ads-close">${e.playDuration<=0?e.i18n.close:P(e.playDuration,e.i18n.canBeClosed)}</div><div class="artplayer-plugin-ads-countdown">${P(e.totalDuration,e.i18n.countdown)}</div></div>`)),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,`<div class="artplayer-plugin-ads-control"><div class="artplayer-plugin-ads-detail">${e.i18n.detail}</div><div class="artplayer-plugin-ads-muted"></div><div class="artplayer-plugin-ads-fullscreen"></div></div>`)),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.Line truncated
|
||||
function l(e){return n=>{!function(e){const{version:n,utils:{errorHandle:a}}=e.constructor,i=n.split(".").map(Number);a(i[0]+i[1]/100>=5,`Artplayer.js@${n} is not compatible the artplayerPluginAds@${l.version}. Please update it to version Artplayer.js@5.x.x`)}(n);const{template:{$player:a},icons:{volume:i,volumeClose:t,fullscreenOn:r,fullscreenOff:d,loading:o},constructor:{validator:s,utils:{query:p,append:u,setStyle:c}}}=n;e=s({html:"",video:"",url:"",playDuration:5,totalDuration:10,muted:!1,i18n:{close:"\u5173\u95ed\u5e7f\u544a",countdown:"%s\u79d2",detail:"\u67e5\u770b\u8be6\u60c5",canBeClosed:"%s\u79d2\u540e\u53ef\u5173\u95ed\u5e7f\u544a"},...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,g=null,m=null,f=null,v=null,x=null,h=0,w=null,b=!1,$=!1,k=!1;function D(l,e){return e.replace("%s",l)}function A(){b=!0,n.play(),e.video&&y.pause(),c(n.template.$ads,"display","none"),n.emit("artplayerPluginAds:skip",e)}function C(){b||(w=setTimeout(()=>{h+=1;const l=e.playDuration-h;l>=1?m.innerHTML=D(l,e.i18n.canBeClosed):(m.innerHTML=e.i18n.close,k||(k=!0)),f.innerHTML=D(e.totalDuration-h,e.i18n.countdown),h>=e.totalDuration?A():C()},1e3))}function P(){b||clearTimeout(w)}function B(){$||($=!0,function(){n.template.$ads=u(a,'<div class="artplayer-plugin-ads"></div>'),y=u(n.template.$ads,e.video?`<video class="artplayer-plugin-ads-video" src="${e.video}" loop playsInline></video>`:`<div class="artplayer-plugin-ads-html">${e.html}</div>`),x=u(n.template.$ads,'<div class="artplayer-plugin-ads-loading"></div>'),u(x,o),g=u(n.template.$ads,`<div class="artplayer-plugin-ads-timer">\n <div class="artplayer-plugin-ads-close">${e.playDuration<=0?e.i18n.close:D(e.playDuration,e.i18n.canBeClosed)}</div>\n <div class="artplayer-plugin-ads-countdown">${D(e.totalDuration,e.i18n.countdown)}</div>\n </div>`),m=p(".artplayer-plugin-ads-close",g),f=p(".artplayer-plugin-ads-countdown",g),e.playDuration>=e.totalDuration&&c(m,"display","none"),n.proxy(m,"click",()=>{k&&A()}),v=u(n.template.$ads,`<div class="artplayer-plugin-ads-control">\n <div class="artplayer-plugin-ads-detail">${e.i18n.detail}</div>\n <div class="artplayer-plugin-ads-muted"></div>\n <div class="artplayer-plugin-ads-fullscreen"></div>\n </div>`);const l=p(".artplayer-plugin-ads-detail",v),s=p(".artplayer-plugin-ads-muted",v),h=p(".artplayer-plugin-ads-fullscreen",v);if(e.url?n.proxy(l,"click",()=>{window.open(e.url),n.emit("artplayerPluginAds:click",e)}):c(l,"display","none"),e.video){const l=u(s,i),a=u(s,t);c(a,"display","none"),e.muted&&(y.muted=!0,c(l,"display","none"),c(a,"display","inline-flex")),n.proxy(s,"click",()=>{y.muted=!y.muted,y.muted?(c(l,"display","none"),c(a,"display","inline-flex")):(c(l,"display","inline-flex"),c(a,"display","none"))})}else c(s,"display","none");const w=u(h,r),b=u(h,d);c(b,"display","none"),n.proxy(h,"click",()=>{n.fullscreen=!n.fullscreen,n.fullscreen?(c(w,"display","inline-flex"),c(b,"display","none")):(c(w,"display","none"),c(b,"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",A),n.proxy(y,"loadedmetadata",()=>{C(),y.play(),c(g,"display","flex"),c(v,"display","flex"),c(x,"display","none")})):(C(),c(g,"display","flex"),c(v,"display","flex"),c(x,"display","none")),n.on("document:visibilitychange",()=>{document.hidden?P():C()}))}return n.on("ready",()=>{n.once("play",B),n.once("video:playing",B)}),{name:"artplayerPluginAds",skip:A,pause:P,play:C}}}if("undefined"!==typeof document&&!document.getElementById("artplayer-plugin-ads")){const l=document.createElement("style");l.id="artplayer-plugin-ads",l.textContent=".artplayer-plugin-ads{position:absolute;z-index:150;inset:0;width:100%;height:100%;overflow:hidden;font-size:13px;line-height:1;color:#fff;background-color:#000}.artplayer-plugin-ads .artplayer-plugin-ads-html{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.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{display:flex;align-items:center;background-color:#00000080;border-radius:15px;margin-left:5px;padding:5px 10px;cursor:pointer}.artplayer-plugin-ads .artplayer-plugin-ads-control{display:none;position:absolute;bottom:10px;right:10px}.artplayer-plugin-ads .artplayer-plugin-ads-control>div{display:flex;align-items:center;background-color:#00000080;border-radius:15px;margin-left:5px;padding:5px 10px;cursor:pointer}.artplayer-plugin-ads .artplayer-plugin-ads-control .art-icon svg{width:20px;height:20px}.artplayer-plugin-ads .artplayer-plugin-ads-lLine truncated
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "artplayer-plugin-ads",
|
||||
"version": "2.0.0",
|
||||
"version": "2.0.1",
|
||||
"description": "Ads plugin for ArtPlayer",
|
||||
"author": "Harvey Zhao <laozhaochaguan@gmail.com>",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import style from 'bundle-text:./style.less'
|
||||
import style from './style.less?inline'
|
||||
|
||||
function checkVersion(art) {
|
||||
const {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-ambilight.js v1.0.0
|
||||
* artplayer-plugin-ambilight.js v1.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,r,t,n,o){var i="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},u="function"==typeof i[n]&&i[n],l=u.i||{},a=u.cache||{},f="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(r,t){if(!a[r]){if(!e[r]){if(o[r])return o[r];var l="function"==typeof i[n]&&i[n];if(!t&&l)return l(r,!0);if(u)return u(r,!0);if(f&&"string"==typeof r)return f(r);var d=Error("Cannot find module '"+r+"'");throw d.code="MODULE_NOT_FOUND",d}p.resolve=function(t){var n=e[r][1][t];return null!=n?n:t},p.cache={};var s=a[r]=new c.Module(r);e[r][0].call(s.exports,p,s,s.exports,i)}return a[r].exports;function p(e){var r=p.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=c(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 c(r)}}c.isParcelRequire=!0,c.Module=function(e){this.id=e,this.bundle=c,this.require=f,this.exports={}},c.modules=e,c.cache=a,c.parent=u,c.distDir=void 0,c.publicUrl=void 0,c.devServer=void 0,c.i=l,c.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(c,"root",{get:function(){return i[n]}}),i[n]=c;for(var d=0;d<r.length;d++)c(r[d]);if(t){var s=c(t);"object"==typeof exports&&"u">typeof module?module.exports=s:"function"==typeof define&&define.amd&&define(function(){return s})}}({"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("<div></div>").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",{});
|
||||
!function(e,t){"object"===typeof exports&&"undefined"!==typeof module?module.exports=t():"function"==typeof define&&define.amd?(t.ArtplayerPluginAmbilight=t(),define(function(){return t.ArtplayerPluginAmbilight})):(e="undefined"!==typeof globalThis?globalThis:e||self).ArtplayerPluginAmbilight=t()}(this,function(){"use strict";function e(e={}){return t=>{const{$video:n}=t.template,{createElement:i,addClass:r,setStyles:o}=t.constructor.utils,{blur:a="50px",opacity:l=.5,frequency:d=10,duration:u=.3}=e,f=i("div"),s=((c=f).innerHTML=Array.from({length:9}).fill("<div></div>").join(""),Array.from(c.children));var c,p,m,g;!function(e,t){r(e,"artplayer-plugin-ambilight"),t.parentNode.insertBefore(e,t),o(e,{position:"absolute",top:0,left:0,zIndex:9,inset:0,display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"1fr 1fr 1fr"})}(f,n),p=a,m=l,g=u,s.forEach(e=>{o(e,{opacity:m,filter:`blur(${p})`,transition:`background-color ${g}s ease`})});const y=function(e,n,r){const o=i("canvas"),a=o.getContext("2d");o.width=3,o.height=3;let l=0;return function i(){const o=performance.now();if(o-l<1e3/r||!t.playing)return void(h=requestAnimationFrame(i));l=o;const d=e.videoWidth/3,u=e.videoHeight/3,f=[[0,0],[d,0],[2*d,0],[0,u],[d,u],[2*d,u],[0,2*u],[d,2*u],[2*d,2*u]].map(([t,n])=>function(t,n,i,r){a.drawImage(e,t,n,i,r,0,0,1,1);const[o,l,d]=a.getImageData(0,0,1,1).data;return`rgb(${o}, ${l}, ${d})`}(t,n,d,u));n.forEach((e,t)=>{e.style.backgroundColor=f[t]}),h=requestAnimationFrame(i)}}(n,s,d);let h=null;function b(){h||y()}function v(){h&&(cancelAnimationFrame(h),h=null)}return t.on("ready",b),t.on("destroy",v),{name:"artplayerPluginAmbilight",start:b,stop:v}}}return"undefined"!==typeof window&&(window.artplayerPluginAmbilight=e),e});
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-ambilight.js v1.0.0
|
||||
* artplayer-plugin-ambilight.js v1.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,r,t,n,o){var i="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},a="function"==typeof i[n]&&i[n],u=a.i||{},c=a.cache||{},f="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function l(r,t){if(!c[r]){if(!e[r]){if(o[r])return o[r];var u="function"==typeof i[n]&&i[n];if(!t&&u)return u(r,!0);if(a)return a(r,!0);if(f&&"string"==typeof r)return f(r);var d=Error("Cannot find module '"+r+"'");throw d.code="MODULE_NOT_FOUND",d}p.resolve=function(t){var n=e[r][1][t];return null!=n?n:t},p.cache={};var s=c[r]=new l.Module(r);e[r][0].call(s.exports,p,s,s.exports,i)}return c[r].exports;function p(e){var r=p.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=l(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 l(r)}}l.isParcelRequire=!0,l.Module=function(e){this.id=e,this.bundle=l,this.require=f,this.exports={}},l.modules=e,l.cache=c,l.parent=a,l.distDir=void 0,l.publicUrl=void 0,l.devServer=void 0,l.i=u,l.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(l,"root",{get:function(){return i[n]}}),i[n]=l;for(var d=0;d<r.length;d++)l(r[d]);if(t){var s=l(t);"object"==typeof exports&&"u">typeof module?module.exports=s:"function"==typeof define&&define.amd&&define(function(){return s})}}({"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("<div></div>").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,nLine truncated
|
||||
!function(e,t){"object"===typeof exports&&"undefined"!==typeof module?module.exports=t():"function"==typeof define&&define.amd?(t.ArtplayerPluginAmbilight=t(),define(function(){return t.ArtplayerPluginAmbilight})):(e="undefined"!==typeof globalThis?globalThis:e||self).ArtplayerPluginAmbilight=t()}(this,function(){"use strict";function e(e={}){return t=>{const{$video:n}=t.template,{createElement:i,addClass:r,setStyles:o}=t.constructor.utils,{blur:a="50px",opacity:l=.5,frequency:d=10,duration:u=.3}=e,f=i("div"),s=((c=f).innerHTML=Array.from({length:9}).fill("<div></div>").join(""),Array.from(c.children));var c,p,m,g;!function(e,t){r(e,"artplayer-plugin-ambilight"),t.parentNode.insertBefore(e,t),o(e,{position:"absolute",top:0,left:0,zIndex:9,inset:0,display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"1fr 1fr 1fr"})}(f,n),p=a,m=l,g=u,s.forEach(e=>{o(e,{opacity:m,filter:`blur(${p})`,transition:`background-color ${g}s ease`})});const y=function(e,n,r){const o=i("canvas"),a=o.getContext("2d");o.width=3,o.height=3;let l=0;return function i(){const o=performance.now();if(o-l<1e3/r||!t.playing)return void(h=requestAnimationFrame(i));l=o;const d=e.videoWidth/3,u=e.videoHeight/3,f=[[0,0],[d,0],[2*d,0],[0,u],[d,u],[2*d,u],[0,2*u],[d,2*u],[2*d,2*u]].map(([t,n])=>function(t,n,i,r){a.drawImage(e,t,n,i,r,0,0,1,1);const[o,l,d]=a.getImageData(0,0,1,1).data;return`rgb(${o}, ${l}, ${d})`}(t,n,d,u));n.forEach((e,t)=>{e.style.backgroundColor=f[t]}),h=requestAnimationFrame(i)}}(n,s,d);let h=null;function b(){h||y()}function v(){h&&(cancelAnimationFrame(h),h=null)}return t.on("ready",b),t.on("destroy",v),{name:"artplayerPluginAmbilight",start:b,stop:v}}}return"undefined"!==typeof window&&(window.artplayerPluginAmbilight=e),e});
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-ambilight.js v1.0.0
|
||||
* artplayer-plugin-ambilight.js v1.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,r,t,n,o){var i="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},u="function"==typeof i[n]&&i[n],l=u.i||{},a=u.cache||{},f="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(r,t){if(!a[r]){if(!e[r]){if(o[r])return o[r];var l="function"==typeof i[n]&&i[n];if(!t&&l)return l(r,!0);if(u)return u(r,!0);if(f&&"string"==typeof r)return f(r);var d=Error("Cannot find module '"+r+"'");throw d.code="MODULE_NOT_FOUND",d}s.resolve=function(t){var n=e[r][1][t];return null!=n?n:t},s.cache={};var p=a[r]=new c.Module(r);e[r][0].call(p.exports,s,p,p.exports,i)}return a[r].exports;function s(e){var r=s.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=c(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 c(r)}}c.isParcelRequire=!0,c.Module=function(e){this.id=e,this.bundle=c,this.require=f,this.exports={}},c.modules=e,c.cache=a,c.parent=u,c.distDir=void 0,c.publicUrl=void 0,c.devServer=void 0,c.i=l,c.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(c,"root",{get:function(){return i[n]}}),i[n]=c;for(var d=0;d<r.length;d++)c(r[d]);if(t){var p=c(t);"object"==typeof exports&&"u">typeof module?module.exports=p:"function"==typeof define&&define.amd&&define(function(){return p})}}({"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("<div></div>").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};
|
||||
function t(t={}){return e=>{const{$video:n}=e.template,{createElement:r,addClass:i,setStyles:o}=e.constructor.utils,{blur:a="50px",opacity:l=.5,frequency:d=10,duration:u=.3}=t,s=r("div"),c=((f=s).innerHTML=Array.from({length:9}).fill("<div></div>").join(""),Array.from(f.children));var f,m,g,p;!function(t,e){i(t,"artplayer-plugin-ambilight"),e.parentNode.insertBefore(t,e),o(t,{position:"absolute",top:0,left:0,zIndex:9,inset:0,display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"1fr 1fr 1fr"})}(s,n),m=a,g=l,p=u,c.forEach(t=>{o(t,{opacity:g,filter:`blur(${m})`,transition:`background-color ${p}s ease`})});const y=function(t,n,i){const o=r("canvas"),a=o.getContext("2d");o.width=3,o.height=3;let l=0;return function r(){const o=performance.now();if(o-l<1e3/i||!e.playing)return void(h=requestAnimationFrame(r));l=o;const d=t.videoWidth/3,u=t.videoHeight/3,s=[[0,0],[d,0],[2*d,0],[0,u],[d,u],[2*d,u],[0,2*u],[d,2*u],[2*d,2*u]].map(([e,n])=>function(e,n,r,i){a.drawImage(t,e,n,r,i,0,0,1,1);const[o,l,d]=a.getImageData(0,0,1,1).data;return`rgb(${o}, ${l}, ${d})`}(e,n,d,u));n.forEach((t,e)=>{t.style.backgroundColor=s[e]}),h=requestAnimationFrame(r)}}(n,c,d);let h=null;function b(){h||y()}function v(){h&&(cancelAnimationFrame(h),h=null)}return e.on("ready",b),e.on("destroy",v),{name:"artplayerPluginAmbilight",start:b,stop:v}}}"undefined"!==typeof window&&(window.artplayerPluginAmbilight=t);export{t as default};
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "artplayer-plugin-ambilight",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "ambilight plugin for ArtPlayer",
|
||||
"author": "Harvey Zhao <laozhaochaguan@gmail.com>",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-asr.js v2.0.0
|
||||
* artplayer-plugin-asr.js v2.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,n,o){var a="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},i="function"==typeof a[n]&&a[n],l=i.i||{},u=i.cache||{},s="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,r){if(!u[t]){if(!e[t]){if(o[t])return o[t];var l="function"==typeof a[n]&&a[n];if(!r&&l)return l(t,!0);if(i)return i(t,!0);if(s&&"string"==typeof t)return s(t);var d=Error("Cannot find module '"+t+"'");throw d.code="MODULE_NOT_FOUND",d}f.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},f.cache={};var p=u[t]=new c.Module(t);e[t][0].call(p.exports,f,p,p.exports,a)}return u[t].exports;function f(e){var t=f.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=c(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 c(t)}}c.isParcelRequire=!0,c.Module=function(e){this.id=e,this.bundle=c,this.require=s,this.exports={}},c.modules=e,c.cache=u,c.parent=i,c.distDir=void 0,c.publicUrl=void 0,c.devServer=void 0,c.i=l,c.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(c,"root",{get:function(){return a[n]}}),a[n]=c;for(var d=0;d<t.length;d++)c(t[d]);if(r){var p=c(r);"object"==typeof exports&&"u">typeof module?module.exports=p:"function"==typeof define&&define.amd&&define(function(){return p})}}({"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=>`<div class="art-asr-line">${e}</div>`).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<t&&d.length;){let e=d.shift(),t=new Float32Array(l.length+e.length);t.set(l,0),t.set(e,l.length),l=t}if(l.length<t)return;let u=l.slice(0,t),s=function(e){let t=e.length,r=new ArrayBuffer(2*t),n=new DataView(r);for(let r=0;r<t;r++){let t=Math.max(-1,Math.min(1,e[r]));n.setInt16(2*r,t<0?32768*t:32767*t,!0)}return r}(u),c=(e=s.byteLength,r=new ArrayBuffer(44+e),o=new DataView(r),(i=(e,t)=>{for(let r=0;r<t.length;r++)o.setUint8(e+r,t.charCodeAt(r))})(0,"RIFF"),o.setUint32(4,36+e,!0),i(8,"WAVE"),i(12,"fmt "),o.setUint32(16,16,!0),o.setUint16(20,1,!0),o.setUint16(22,1,!0),o.setUint32(24,n,!0),o.setUint32(28,2*n,!0),o.setUint16(32,2,!0),o.setUint16(34,16,!0),i(36,"data"),o.setUint32(40,e,!0),new Uint8Array(r).set(new Uint8Array(s),44),r),p=await a({pcm:s,wav:c});h(p)},r),i=!0}catch(e){console.error("[artplayerPluginAsr] Initialization failed:",e),await M()}}async function M(){i&&(i=!1,clearInterval(p),p=null,s&&(s.disconnect(),s.port.onmessage=null,s=null),c&&(c.disconnect(),c=null),d=[])}async function U(){await M()Line truncated
|
||||
!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.ArtplayerPluginAsr=e(),define(function(){return t.ArtplayerPluginAsr})):(t="undefined"!==typeof globalThis?globalThis:t||self).ArtplayerPluginAsr=e()}(this,function(){"use strict";function t(t={}){const{length:e=3,interval:n=100,sampleRate:r=16e3,autoHideTimeout:a=1e4,onAudioChunk:o=()=>null}=t;return t=>{let i=!1,l=null,s=null,u=null,c=null,d=[],p=null,f=!1,y=null,m=null,g=null;const w=t.layers.add({name:"asr",html:""});function h(){w.style.display="none"}function b(t){var n;"string"===typeof t&&(clearTimeout(y),y=setTimeout(h,a),w.style.display="",w.innerHTML=(n=t,n.split(/(?<=[\u3001\u3002\uff01\uff1f!?.])\s*/u).map(t=>t.trim()).filter(Boolean).slice(-e)).map(t=>`<div class="art-asr-line">${t}</div>`).join(""))}async function v(){if(!s&&t.video)try{return s=l.createMediaElementSource(t.video),s}catch(e){console.warn("[artplayerPluginAsr] Direct connection failed:",e)}try{if(m||(m=await async function(t){try{return t.captureStream?t.captureStream():t.mozCaptureStream?t.mozCaptureStream():(console.warn("[artplayerPluginAsr] captureStream not supported"),null)}catch(e){return console.warn("[artplayerPluginAsr] Error capturing stream:",e),null}}(t.video)),m)return g=l.createMediaStreamSource(m),g}catch(e){console.warn("[artplayerPluginAsr] MediaStream fallback failed:",e)}return null}async function x(){i&&(i=!1,clearInterval(p),p=null,u&&(u.disconnect(),u.port.onmessage=null,u=null),c&&(c.disconnect(),c=null),d=[])}async function A(){await x(),g&&(g.disconnect(),g=null),s&&(s.disconnect(),s=null),m&&(m.getTracks().forEach(t=>t.stop()),m=null),l&&(await l.close(),l=null),f=!1}return t.on("video:volumechange",()=>{c&&(c.gain.value=t.volume)}),t.on("play",async function(){if(!i)try{await async function(){return l||(l=new(window.AudioContext||window.webkitAudioContext)({sampleRate:r}),"suspended"===l.state&&await l.resume(),l)}();const t=await v();if(!t)throw new Error("Could not establish audio source");if(!f){const t=(()=>{const t=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(t)})();await l.audioWorklet.addModule(t),URL.revokeObjectURL(t),f=!0}c=l.createGain(),c.gain.value=1,u=new AudioWorkletNode(l,"recorder-processor"),u.port.onmessage=t=>{d.push(new Float32Array(t.data))},t.connect(u),t.connect(c),c.connect(l.destination);const e=r*(n/1e3);p=setInterval(async()=>{if(0===d.length)return;let t=new Float32Array(0);for(;t.length<e&&d.length;){const e=d.shift(),n=new Float32Array(t.length+e.length);n.set(t,0),n.set(e,t.length),t=n}if(t.length<e)return;const n=function(t){const e=t.length,n=new ArrayBuffer(2*e),r=new DataView(n);for(let a=0;a<e;a++){const e=Math.max(-1,Math.min(1,t[a]));r.setInt16(2*a,e<0?32768*e:32767*e,!0)}return n}(t.slice(0,e)),a=function(t,e){const n=t.byteLength,r=new ArrayBuffer(44+n),a=new DataView(r),o=(t,e)=>{for(let n=0;n<e.length;n++)a.setUint8(t+n,e.charCodeAt(n))};return o(0,"RIFF"),a.setUint32(4,36+n,!0),o(8,"WAVE"),o(12,"fmt "),a.setUint32(16,16,!0),a.setUint16(20,1,!0),a.setUint16(22,1,!0),a.setUint32(24,e,!0),a.setUint32(28,2*e,!0),a.setUint16(32,2,!0),a.setUint16(34,16,!0),o(36,"data"),a.setUint32(40,n,!0),new Uint8Array(r).set(new Uint8Array(t),44),r}(n,r);b(await o({pcm:n,wav:a}))},n),i=!0}catch(t){console.error("[artplayerPluginAsr] Initialization failed:",t),await x()}}),t.on("pause",x),t.on("destroy",A),{name:"artplayerPluginAsr",stop:A,hide:h,append:b}}}if("undefined"!==typeof document&&!document.getElementById("artplayer-plugin-asr")){const t=document.createElement("style");t.id="artplayer-plugin-asr",t.textContent=".art-video-player .art-layer-asr{pointer-events:none!important;position:absolute;z-index:150;inset:0;display:flex;flex-direction:column;justify-content:end;padding:0 2%;font-size:1rem;gap:var(--art-subtitle-gap);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}.art-video-player.art-control-show .art-layer-asr{padding-bottom:calc(var(--art-control-height) + var(--art-subtitle-bottom))}",document.head.appendChild(t)}return"undefined"!==typeof window&&(window.artplayerPluginAsr=t),t});
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-asr.js v2.0.0
|
||||
* artplayer-plugin-asr.js v2.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,n,o){var a="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},u="function"==typeof a[n]&&a[n],i=u.i||{},l=u.cache||{},s="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(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(u)return u(t,!0);if(s&&"string"==typeof t)return s(t);var f=Error("Cannot find module '"+t+"'");throw f.code="MODULE_NOT_FOUND",f}d.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},d.cache={};var p=l[t]=new c.Module(t);e[t][0].call(p.exports,d,p,p.exports,a)}return l[t].exports;function d(e){var t=d.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=c(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 c(t)}}c.isParcelRequire=!0,c.Module=function(e){this.id=e,this.bundle=c,this.require=s,this.exports={}},c.modules=e,c.cache=l,c.parent=u,c.distDir=void 0,c.publicUrl=void 0,c.devServer=void 0,c.i=i,c.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(c,"root",{get:function(){return a[n]}}),a[n]=c;for(var f=0;f<t.length;f++)c(t[f]);if(r){var p=c(r);"object"==typeof exports&&"u">typeof module?module.exports=p:"function"==typeof define&&define.amd&&define(function(){return p})}}({"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'<div class="art-asr-line">'.concat(e,"</div>")}).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 faileLine truncated
|
||||
!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.ArtplayerPluginAsr=e(),define(function(){return t.ArtplayerPluginAsr})):(t="undefined"!==typeof globalThis?globalThis:t||self).ArtplayerPluginAsr=e()}(this,function(){"use strict";var t=(t,e,n)=>new Promise((r,o)=>{var a=t=>{try{l(n.next(t))}catch(e){o(e)}},i=t=>{try{l(n.throw(t))}catch(e){o(e)}},l=t=>t.done?r(t.value):Promise.resolve(t.value).then(a,i);l((n=n.apply(t,e)).next())});function e(e={}){const{length:n=3,interval:r=100,sampleRate:o=16e3,autoHideTimeout:a=1e4,onAudioChunk:i=()=>null}=e;return e=>{let l=!1,s=null,u=null,c=null,d=null,p=[],f=null,y=!1,m=null,h=null,g=null;const v=e.layers.add({name:"asr",html:""});function b(){v.style.display="none"}function w(t){var e;"string"===typeof t&&(clearTimeout(m),m=setTimeout(b,a),v.style.display="",v.innerHTML=(e=t,e.split(new RegExp("(?<=[\u3001\u3002\uff01\uff1f!?.])\\s*","u")).map(t=>t.trim()).filter(Boolean).slice(-n)).map(t=>`<div class="art-asr-line">${t}</div>`).join(""))}function x(){return t(this,null,function*(){if(!u&&e.video)try{return u=s.createMediaElementSource(e.video),u}catch(n){console.warn("[artplayerPluginAsr] Direct connection failed:",n)}try{if(h||(h=yield function(e){return t(this,null,function*(){try{return e.captureStream?e.captureStream():e.mozCaptureStream?e.mozCaptureStream():(console.warn("[artplayerPluginAsr] captureStream not supported"),null)}catch(n){return console.warn("[artplayerPluginAsr] Error capturing stream:",n),null}})}(e.video)),h)return g=s.createMediaStreamSource(h),g}catch(n){console.warn("[artplayerPluginAsr] MediaStream fallback failed:",n)}return null})}function A(){return t(this,null,function*(){l&&(l=!1,clearInterval(f),f=null,c&&(c.disconnect(),c.port.onmessage=null,c=null),d&&(d.disconnect(),d=null),p=[])})}function U(){return t(this,null,function*(){yield A(),g&&(g.disconnect(),g=null),u&&(u.disconnect(),u=null),h&&(h.getTracks().forEach(t=>t.stop()),h=null),s&&(yield s.close(),s=null),y=!1})}return e.on("video:volumechange",()=>{d&&(d.gain.value=e.volume)}),e.on("play",function(){return t(this,null,function*(){if(!l)try{yield function(){return t(this,null,function*(){return s||(s=new(window.AudioContext||window.webkitAudioContext)({sampleRate:o}),"suspended"===s.state&&(yield s.resume()),s)})}();const e=yield x();if(!e)throw new Error("Could not establish audio source");if(!y){const t=(()=>{const t=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(t)})();yield s.audioWorklet.addModule(t),URL.revokeObjectURL(t),y=!0}d=s.createGain(),d.gain.value=1,c=new AudioWorkletNode(s,"recorder-processor"),c.port.onmessage=t=>{p.push(new Float32Array(t.data))},e.connect(c),e.connect(d),d.connect(s.destination);const n=o*(r/1e3);f=setInterval(()=>t(null,null,function*(){if(0===p.length)return;let t=new Float32Array(0);for(;t.length<n&&p.length;){const e=p.shift(),n=new Float32Array(t.length+e.length);n.set(t,0),n.set(e,t.length),t=n}if(t.length<n)return;const e=function(t){const e=t.length,n=new ArrayBuffer(2*e),r=new DataView(n);for(let o=0;o<e;o++){const e=Math.max(-1,Math.min(1,t[o]));r.setInt16(2*o,e<0?32768*e:32767*e,!0)}return n}(t.slice(0,n)),r=function(t,e){const n=t.byteLength,r=new ArrayBuffer(44+n),o=new DataView(r),a=(t,e)=>{for(let n=0;n<e.length;n++)o.setUint8(t+n,e.charCodeAt(n))};return a(0,"RIFF"),o.setUint32(4,36+n,!0),a(8,"WAVE"),a(12,"fmt "),o.setUint32(16,16,!0),o.setUint16(20,1,!0),o.setUint16(22,1,!0),o.setUint32(24,e,!0),o.setUint32(28,2*e,!0),o.setUint16(32,2,!0),o.setUint16(34,16,!0),a(36,"data"),o.setUint32(40,n,!0),new Uint8Array(r).set(new Uint8Array(t),44),r}(e,o);w(yield i({pcm:e,wav:r}))}),r),l=!0}catch(e){console.error("[artplayerPluginAsr] Initialization failed:",e),yield A()}})}),e.on("pause",A),e.on("destroy",U),{name:"artplayerPluginAsr",stop:U,hide:b,append:w}}}if("undefined"!==typeof document&&!document.getElementById("artplayer-plugin-asr")){const t=document.createElement("style");t.id="artplayer-plugin-asr",t.textContent=".art-video-player .art-layer-asr{pointer-events:none!important;position:absolute;z-index:150;inset:0;display:flex;flex-direction:column;justify-content:end;padding:0 2%;font-size:1rem;gap:var(--art-subtitle-gap);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-subtLine truncated
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-asr.js v2.0.0
|
||||
* artplayer-plugin-asr.js v2.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,n,o){var a="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},l="function"==typeof a[n]&&a[n],i=l.i||{},u=l.cache||{},s="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,r){if(!u[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(l)return l(t,!0);if(s&&"string"==typeof t)return s(t);var d=Error("Cannot find module '"+t+"'");throw d.code="MODULE_NOT_FOUND",d}f.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},f.cache={};var p=u[t]=new c.Module(t);e[t][0].call(p.exports,f,p,p.exports,a)}return u[t].exports;function f(e){var t=f.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=c(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 c(t)}}c.isParcelRequire=!0,c.Module=function(e){this.id=e,this.bundle=c,this.require=s,this.exports={}},c.modules=e,c.cache=u,c.parent=l,c.distDir=void 0,c.publicUrl=void 0,c.devServer=void 0,c.i=i,c.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(c,"root",{get:function(){return a[n]}}),a[n]=c;for(var d=0;d<t.length;d++)c(t[d]);if(r){var p=c(r);"object"==typeof exports&&"u">typeof module?module.exports=p:"function"==typeof define&&define.amd&&define(function(){return p})}}({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=>`<div class="art-asr-line">${e}</div>`).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<t&&d.length;){let e=d.shift(),t=new Float32Array(i.length+e.length);t.set(i,0),t.set(e,i.length),i=t}if(i.length<t)return;let u=i.slice(0,t),s=function(e){let t=e.length,r=new ArrayBuffer(2*t),n=new DataView(r);for(let r=0;r<t;r++){let t=Math.max(-1,Math.min(1,e[r]));n.setInt16(2*r,t<0?32768*t:32767*t,!0)}return r}(u),c=(e=s.byteLength,r=new ArrayBuffer(44+e),o=new DataView(r),(l=(e,t)=>{for(let r=0;r<t.length;r++)o.setUint8(e+r,t.charCodeAt(r))})(0,"RIFF"),o.setUint32(4,36+e,!0),l(8,"WAVE"),l(12,"fmt "),o.setUint32(16,16,!0),o.setUint16(20,1,!0),o.setUint16(22,1,!0),o.setUint32(24,n,!0),o.setUint32(28,2*n,!0),o.setUint16(32,2,!0),o.setUint16(34,16,!0),l(36,"data"),o.setUint32(40,e,!0),new Uint8Array(r).set(new Uint8Array(s),44),r),p=await a({pcm:s,wav:c});h(p)},r),l=!0}catch(e){console.error("[artplayerPluginAsr] Initialization failed:",e),await U()}}async function U(){l&&(l=!1,clearInterval(p),p=null,s&&(s.disconnect(),s.port.onmessage=null,s=null),c&&(c.disconnect(),c=null),d=[])}async function O(){await U(),bLine truncated
|
||||
function t(t={}){const{length:e=3,interval:n=100,sampleRate:r=16e3,autoHideTimeout:a=1e4,onAudioChunk:o=()=>null}=t;return t=>{let i=!1,l=null,s=null,u=null,c=null,d=[],p=null,y=!1,f=null,m=null,w=null;const g=t.layers.add({name:"asr",html:""});function h(){g.style.display="none"}function v(t){var n;"string"===typeof t&&(clearTimeout(f),f=setTimeout(h,a),g.style.display="",g.innerHTML=(n=t,n.split(/(?<=[\u3001\u3002\uff01\uff1f!?.])\s*/u).map(t=>t.trim()).filter(Boolean).slice(-e)).map(t=>`<div class="art-asr-line">${t}</div>`).join(""))}async function b(){if(!s&&t.video)try{return s=l.createMediaElementSource(t.video),s}catch(e){console.warn("[artplayerPluginAsr] Direct connection failed:",e)}try{if(m||(m=await async function(t){try{return t.captureStream?t.captureStream():t.mozCaptureStream?t.mozCaptureStream():(console.warn("[artplayerPluginAsr] captureStream not supported"),null)}catch(e){return console.warn("[artplayerPluginAsr] Error capturing stream:",e),null}}(t.video)),m)return w=l.createMediaStreamSource(m),w}catch(e){console.warn("[artplayerPluginAsr] MediaStream fallback failed:",e)}return null}async function x(){i&&(i=!1,clearInterval(p),p=null,u&&(u.disconnect(),u.port.onmessage=null,u=null),c&&(c.disconnect(),c=null),d=[])}async function A(){await x(),w&&(w.disconnect(),w=null),s&&(s.disconnect(),s=null),m&&(m.getTracks().forEach(t=>t.stop()),m=null),l&&(await l.close(),l=null),y=!1}return t.on("video:volumechange",()=>{c&&(c.gain.value=t.volume)}),t.on("play",async function(){if(!i)try{await async function(){return l||(l=new(window.AudioContext||window.webkitAudioContext)({sampleRate:r}),"suspended"===l.state&&await l.resume(),l)}();const t=await b();if(!t)throw new Error("Could not establish audio source");if(!y){const t=(()=>{const t=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(t)})();await l.audioWorklet.addModule(t),URL.revokeObjectURL(t),y=!0}c=l.createGain(),c.gain.value=1,u=new AudioWorkletNode(l,"recorder-processor"),u.port.onmessage=t=>{d.push(new Float32Array(t.data))},t.connect(u),t.connect(c),c.connect(l.destination);const e=r*(n/1e3);p=setInterval(async()=>{if(0===d.length)return;let t=new Float32Array(0);for(;t.length<e&&d.length;){const e=d.shift(),n=new Float32Array(t.length+e.length);n.set(t,0),n.set(e,t.length),t=n}if(t.length<e)return;const n=function(t){const e=t.length,n=new ArrayBuffer(2*e),r=new DataView(n);for(let a=0;a<e;a++){const e=Math.max(-1,Math.min(1,t[a]));r.setInt16(2*a,e<0?32768*e:32767*e,!0)}return n}(t.slice(0,e)),a=function(t,e){const n=t.byteLength,r=new ArrayBuffer(44+n),a=new DataView(r),o=(t,e)=>{for(let n=0;n<e.length;n++)a.setUint8(t+n,e.charCodeAt(n))};return o(0,"RIFF"),a.setUint32(4,36+n,!0),o(8,"WAVE"),o(12,"fmt "),a.setUint32(16,16,!0),a.setUint16(20,1,!0),a.setUint16(22,1,!0),a.setUint32(24,e,!0),a.setUint32(28,2*e,!0),a.setUint16(32,2,!0),a.setUint16(34,16,!0),o(36,"data"),a.setUint32(40,n,!0),new Uint8Array(r).set(new Uint8Array(t),44),r}(n,r);v(await o({pcm:n,wav:a}))},n),i=!0}catch(t){console.error("[artplayerPluginAsr] Initialization failed:",t),await x()}}),t.on("pause",x),t.on("destroy",A),{name:"artplayerPluginAsr",stop:A,hide:h,append:v}}}if("undefined"!==typeof document&&!document.getElementById("artplayer-plugin-asr")){const t=document.createElement("style");t.id="artplayer-plugin-asr",t.textContent=".art-video-player .art-layer-asr{pointer-events:none!important;position:absolute;z-index:150;inset:0;display:flex;flex-direction:column;justify-content:end;padding:0 2%;font-size:1rem;gap:var(--art-subtitle-gap);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}.art-video-player.art-control-show .art-layer-asr{padding-bottom:calc(var(--art-control-height) + var(--art-subtitle-bottom))}",document.head.appendChild(t)}"undefined"!==typeof window&&(window.artplayerPluginAsr=t);export{t as default};
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "artplayer-plugin-asr",
|
||||
"version": "2.0.0",
|
||||
"version": "2.0.1",
|
||||
"description": "Asr plugin for ArtPlayer",
|
||||
"author": "Harvey Zhao <laozhaochaguan@gmail.com>",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import style from 'bundle-text:./style.less'
|
||||
import style from './style.less?inline'
|
||||
|
||||
export default function artplayerPluginAsr(option = {}) {
|
||||
const {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-audio-track.js v1.0.1
|
||||
* artplayer-plugin-audio-track.js v1.0.2
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,r,t,o,n){var u="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},i="function"==typeof u[o]&&u[o],a=i.i||{},l=i.cache||{},c="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(r,t){if(!l[r]){if(!e[r]){if(n[r])return n[r];var a="function"==typeof u[o]&&u[o];if(!t&&a)return a(r,!0);if(i)return i(r,!0);if(c&&"string"==typeof r)return c(r);var d=Error("Cannot find module '"+r+"'");throw d.code="MODULE_NOT_FOUND",d}s.resolve=function(t){var o=e[r][1][t];return null!=o?o:t},s.cache={};var p=l[r]=new f.Module(r);e[r][0].call(p.exports,s,p,p.exports,u)}return l[r].exports;function s(e){var r=s.resolve(e);if(!1===r)return{};if(Array.isArray(r)){var t={__esModule:!0};return r.forEach(function(e){var r=e[0],o=e[1],n=e[2]||e[0],u=f(o);"*"===r?Object.keys(u).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:function(){return u[e]}})}):"*"===n?Object.defineProperty(t,r,{enumerable:!0,value:u}):Object.defineProperty(t,r,{enumerable:!0,get:function(){return"default"===n?u.__esModule?u.default:u:u[n]}})}),t}return f(r)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=c,this.exports={}},f.modules=e,f.cache=l,f.parent=i,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=a,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(f,"root",{get:function(){return u[o]}}),u[o]=f;for(var d=0;d<r.length;d++)f(r[d]);if(t){var p=f(t);"object"==typeof exports&&"u">typeof module?module.exports=p:"function"==typeof define&&define.amd&&define(function(){return p})}}({b4T6O:[function(e,r,t,o){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");function u(e){return r=>{let{url:t,offset:o=0,sync:n=.3}=e,u=new Audio;function i(){if(!r.video||!t)return;let e=r.currentTime+o;Math.abs(u.currentTime-e)>n&&(u.currentTime=e)}return u.preload="auto",t&&(u.src=t),r.on("play",()=>{t&&(i(),u.play().catch(e=>{console.warn(e)}))}),r.on("pause",()=>{u.pause()}),r.on("seek",()=>{i()}),r.on("video:timeupdate",()=>{r.playing&&i()}),r.on("video:ratechange",()=>{u.playbackRate=r.video.playbackRate}),r.on("video:volumechange",()=>{u.volume=r.volume,u.muted=r.muted}),r.on("video:waiting",()=>{u.pause()}),r.on("video:playing",()=>{t&&r.playing&&u.play().catch(e=>{console.warn(e)})}),r.on("destroy",()=>{u.pause(),u.src="",u.load()}),u.volume=r.volume,u.muted=r.muted,u.playbackRate=r.video?.playbackRate||1,{name:"artplayerPluginAudioTrack",audio:u,update:function(e){e.url&&e.url!==t&&(u.src=t=e.url,r.playing&&u.play().catch(e=>console.warn(e))),void 0!==e.offset&&(o=e.offset),void 0!==e.sync&&(n=e.sync)}}}}n.defineInteropFlag(t),n.export(t,"default",()=>u),"u">typeof window&&(window.artplayerPluginAudioTrack=u)},{"@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"6ykb1":[function(e,r,t,o){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})}},{}]},["b4T6O"],"b4T6O","parcelRequire4dc0",{});
|
||||
!function(e,o){"object"===typeof exports&&"undefined"!==typeof module?module.exports=o():"function"==typeof define&&define.amd?(t.ArtplayerPluginAudioTrack=o(),define(function(){return t.ArtplayerPluginAudioTrack})):(e="undefined"!==typeof globalThis?globalThis:e||self).ArtplayerPluginAudioTrack=o()}(this,function(){"use strict";function e(e){return o=>{let{url:n,offset:a=0,sync:t=.3}=e;const i=new Audio;function u(){if(!o.video||!n)return;const e=o.currentTime+a;Math.abs(i.currentTime-e)>t&&(i.currentTime=e)}return i.preload="auto",n&&(i.src=n),o.on("play",()=>{n&&(u(),i.play().catch(e=>{console.warn(e)}))}),o.on("pause",()=>{i.pause()}),o.on("seek",()=>{u()}),o.on("video:timeupdate",()=>{o.playing&&u()}),o.on("video:ratechange",()=>{i.playbackRate=o.video.playbackRate}),o.on("video:volumechange",()=>{i.volume=o.volume,i.muted=o.muted}),o.on("video:waiting",()=>{i.pause()}),o.on("video:playing",()=>{n&&o.playing&&i.play().catch(e=>{console.warn(e)})}),o.on("destroy",()=>{i.pause(),i.src="",i.load()}),i.volume=o.volume,i.muted=o.muted,i.playbackRate=o.video?.playbackRate||1,{name:"artplayerPluginAudioTrack",audio:i,update:function(e){e.url&&e.url!==n&&(n=e.url,i.src=n,o.playing&&i.play().catch(e=>console.warn(e))),void 0!==e.offset&&(a=e.offset),void 0!==e.sync&&(t=e.sync)}}}}return"undefined"!==typeof window&&(window.artplayerPluginAudioTrack=e),e});
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-audio-track.js v1.0.1
|
||||
* artplayer-plugin-audio-track.js v1.0.2
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,n,o,t,r){var u="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},i="function"==typeof u[t]&&u[t],a=i.i||{},c=i.cache||{},f="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function l(n,o){if(!c[n]){if(!e[n]){if(r[n])return r[n];var a="function"==typeof u[t]&&u[t];if(!o&&a)return a(n,!0);if(i)return i(n,!0);if(f&&"string"==typeof n)return f(n);var d=Error("Cannot find module '"+n+"'");throw d.code="MODULE_NOT_FOUND",d}s.resolve=function(o){var t=e[n][1][o];return null!=t?t:o},s.cache={};var p=c[n]=new l.Module(n);e[n][0].call(p.exports,s,p,p.exports,u)}return c[n].exports;function s(e){var n=s.resolve(e);if(!1===n)return{};if(Array.isArray(n)){var o={__esModule:!0};return n.forEach(function(e){var n=e[0],t=e[1],r=e[2]||e[0],u=l(t);"*"===n?Object.keys(u).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(o,e)||Object.defineProperty(o,e,{enumerable:!0,get:function(){return u[e]}})}):"*"===r?Object.defineProperty(o,n,{enumerable:!0,value:u}):Object.defineProperty(o,n,{enumerable:!0,get:function(){return"default"===r?u.__esModule?u.default:u:u[r]}})}),o}return l(n)}}l.isParcelRequire=!0,l.Module=function(e){this.id=e,this.bundle=l,this.require=f,this.exports={}},l.modules=e,l.cache=c,l.parent=i,l.distDir=void 0,l.publicUrl=void 0,l.devServer=void 0,l.i=a,l.register=function(n,o){e[n]=[function(e,n){n.exports=o},{}]},Object.defineProperty(l,"root",{get:function(){return u[t]}}),u[t]=l;for(var d=0;d<n.length;d++)l(n[d]);if(o){var p=l(o);"object"==typeof exports&&"u">typeof module?module.exports=p:"function"==typeof define&&define.amd&&define(function(){return p})}}({"8tkGC":[function(e,n,o,t){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");function u(e){return function(n){var o,t=e.url,r=e.offset,u=void 0===r?0:r,i=e.sync,a=void 0===i?.3:i,c=new Audio;function f(){if(n.video&&t){var e=n.currentTime+u;Math.abs(c.currentTime-e)>a&&(c.currentTime=e)}}return c.preload="auto",t&&(c.src=t),n.on("play",function(){t&&(f(),c.play().catch(function(e){console.warn(e)}))}),n.on("pause",function(){c.pause()}),n.on("seek",function(){f()}),n.on("video:timeupdate",function(){n.playing&&f()}),n.on("video:ratechange",function(){c.playbackRate=n.video.playbackRate}),n.on("video:volumechange",function(){c.volume=n.volume,c.muted=n.muted}),n.on("video:waiting",function(){c.pause()}),n.on("video:playing",function(){t&&n.playing&&c.play().catch(function(e){console.warn(e)})}),n.on("destroy",function(){c.pause(),c.src="",c.load()}),c.volume=n.volume,c.muted=n.muted,c.playbackRate=(null==(o=n.video)?void 0:o.playbackRate)||1,{name:"artplayerPluginAudioTrack",audio:c,update:function(e){e.url&&e.url!==t&&(c.src=t=e.url,n.playing&&c.play().catch(function(e){return console.warn(e)})),void 0!==e.offset&&(u=e.offset),void 0!==e.sync&&(a=e.sync)}}}}r.defineInteropFlag(o),r.export(o,"default",function(){return u}),"u">typeof window&&(window.artplayerPluginAudioTrack=u)},{"@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],qpMMf:[function(e,n,o,t){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,n){return Object.keys(e).forEach(function(o){"default"===o||"__esModule"===o||Object.prototype.hasOwnProperty.call(n,o)||Object.defineProperty(n,o,{enumerable:!0,get:function(){return e[o]}})}),n},o.export=function(e,n,o){Object.defineProperty(e,n,{enumerable:!0,get:o})}},{}]},["8tkGC"],"8tkGC","parcelRequire4dc0",{});
|
||||
!function(e,o){"object"===typeof exports&&"undefined"!==typeof module?module.exports=o():"function"==typeof define&&define.amd?(t.ArtplayerPluginAudioTrack=o(),define(function(){return t.ArtplayerPluginAudioTrack})):(e="undefined"!==typeof globalThis?globalThis:e||self).ArtplayerPluginAudioTrack=o()}(this,function(){"use strict";function e(e){return o=>{var n;let{url:a,offset:t=0,sync:i=.3}=e;const u=new Audio;function l(){if(!o.video||!a)return;const e=o.currentTime+t;Math.abs(u.currentTime-e)>i&&(u.currentTime=e)}return u.preload="auto",a&&(u.src=a),o.on("play",()=>{a&&(l(),u.play().catch(e=>{console.warn(e)}))}),o.on("pause",()=>{u.pause()}),o.on("seek",()=>{l()}),o.on("video:timeupdate",()=>{o.playing&&l()}),o.on("video:ratechange",()=>{u.playbackRate=o.video.playbackRate}),o.on("video:volumechange",()=>{u.volume=o.volume,u.muted=o.muted}),o.on("video:waiting",()=>{u.pause()}),o.on("video:playing",()=>{a&&o.playing&&u.play().catch(e=>{console.warn(e)})}),o.on("destroy",()=>{u.pause(),u.src="",u.load()}),u.volume=o.volume,u.muted=o.muted,u.playbackRate=(null==(n=o.video)?void 0:n.playbackRate)||1,{name:"artplayerPluginAudioTrack",audio:u,update:function(e){e.url&&e.url!==a&&(a=e.url,u.src=a,o.playing&&u.play().catch(e=>console.warn(e))),void 0!==e.offset&&(t=e.offset),void 0!==e.sync&&(i=e.sync)}}}}return"undefined"!==typeof window&&(window.artplayerPluginAudioTrack=e),e});
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-audio-track.js v1.0.1
|
||||
* artplayer-plugin-audio-track.js v1.0.2
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,r,t,o,n){var u="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},i="function"==typeof u[o]&&u[o],a=i.i||{},l=i.cache||{},f="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(r,t){if(!l[r]){if(!e[r]){if(n[r])return n[r];var a="function"==typeof u[o]&&u[o];if(!t&&a)return a(r,!0);if(i)return i(r,!0);if(f&&"string"==typeof r)return f(r);var d=Error("Cannot find module '"+r+"'");throw d.code="MODULE_NOT_FOUND",d}s.resolve=function(t){var o=e[r][1][t];return null!=o?o:t},s.cache={};var p=l[r]=new c.Module(r);e[r][0].call(p.exports,s,p,p.exports,u)}return l[r].exports;function s(e){var r=s.resolve(e);if(!1===r)return{};if(Array.isArray(r)){var t={__esModule:!0};return r.forEach(function(e){var r=e[0],o=e[1],n=e[2]||e[0],u=c(o);"*"===r?Object.keys(u).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:function(){return u[e]}})}):"*"===n?Object.defineProperty(t,r,{enumerable:!0,value:u}):Object.defineProperty(t,r,{enumerable:!0,get:function(){return"default"===n?u.__esModule?u.default:u:u[n]}})}),t}return c(r)}}c.isParcelRequire=!0,c.Module=function(e){this.id=e,this.bundle=c,this.require=f,this.exports={}},c.modules=e,c.cache=l,c.parent=i,c.distDir=void 0,c.publicUrl=void 0,c.devServer=void 0,c.i=a,c.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(c,"root",{get:function(){return u[o]}}),u[o]=c;for(var d=0;d<r.length;d++)c(r[d]);if(t){var p=c(t);"object"==typeof exports&&"u">typeof module?module.exports=p:"function"==typeof define&&define.amd&&define(function(){return p})}}({fHO26:[function(e,r,t,o){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");function u(e){return r=>{let{url:t,offset:o=0,sync:n=.3}=e,u=new Audio;function i(){if(!r.video||!t)return;let e=r.currentTime+o;Math.abs(u.currentTime-e)>n&&(u.currentTime=e)}return u.preload="auto",t&&(u.src=t),r.on("play",()=>{t&&(i(),u.play().catch(e=>{console.warn(e)}))}),r.on("pause",()=>{u.pause()}),r.on("seek",()=>{i()}),r.on("video:timeupdate",()=>{r.playing&&i()}),r.on("video:ratechange",()=>{u.playbackRate=r.video.playbackRate}),r.on("video:volumechange",()=>{u.volume=r.volume,u.muted=r.muted}),r.on("video:waiting",()=>{u.pause()}),r.on("video:playing",()=>{t&&r.playing&&u.play().catch(e=>{console.warn(e)})}),r.on("destroy",()=>{u.pause(),u.src="",u.load()}),u.volume=r.volume,u.muted=r.muted,u.playbackRate=r.video?.playbackRate||1,{name:"artplayerPluginAudioTrack",audio:u,update:function(e){e.url&&e.url!==t&&(u.src=t=e.url,r.playing&&u.play().catch(e=>console.warn(e))),void 0!==e.offset&&(o=e.offset),void 0!==e.sync&&(n=e.sync)}}}}n.defineInteropFlag(t),n.export(t,"default",()=>u),"u">typeof window&&(window.artplayerPluginAudioTrack=u)},{"@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],loqXi:[function(e,r,t,o){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})}},{}]},["fHO26"],"fHO26","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("fHO26");export{e as default};
|
||||
function e(e){return a=>{let{url:o,offset:n=0,sync:t=.3}=e;const u=new Audio;function i(){if(!a.video||!o)return;const e=a.currentTime+n;Math.abs(u.currentTime-e)>t&&(u.currentTime=e)}return u.preload="auto",o&&(u.src=o),a.on("play",()=>{o&&(i(),u.play().catch(e=>{console.warn(e)}))}),a.on("pause",()=>{u.pause()}),a.on("seek",()=>{i()}),a.on("video:timeupdate",()=>{a.playing&&i()}),a.on("video:ratechange",()=>{u.playbackRate=a.video.playbackRate}),a.on("video:volumechange",()=>{u.volume=a.volume,u.muted=a.muted}),a.on("video:waiting",()=>{u.pause()}),a.on("video:playing",()=>{o&&a.playing&&u.play().catch(e=>{console.warn(e)})}),a.on("destroy",()=>{u.pause(),u.src="",u.load()}),u.volume=a.volume,u.muted=a.muted,u.playbackRate=a.video?.playbackRate||1,{name:"artplayerPluginAudioTrack",audio:u,update:function(e){e.url&&e.url!==o&&(o=e.url,u.src=o,a.playing&&u.play().catch(e=>console.warn(e))),void 0!==e.offset&&(n=e.offset),void 0!==e.sync&&(t=e.sync)}}}}"undefined"!==typeof window&&(window.artplayerPluginAudioTrack=e);export{e as default};
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "artplayer-plugin-audio-track",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"description": "audio-track plugin for ArtPlayer",
|
||||
"author": "Harvey Zhao <laozhaochaguan@gmail.com>",
|
||||
"license": "MIT",
|
||||
@@ -27,7 +27,6 @@
|
||||
"types": "./types/artplayer-plugin-audio-track.d.ts",
|
||||
"import": "./dist/artplayer-plugin-audio-track.legacy.js",
|
||||
"require": "./dist/artplayer-plugin-audio-track.legacy.js"
|
||||
|
||||
}
|
||||
},
|
||||
"main": "dist/artplayer-plugin-audio-track.js",
|
||||
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-auto-thumbnail.js v1.0.1
|
||||
* artplayer-plugin-auto-thumbnail.js v1.0.2
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,o,n){var u="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},i="function"==typeof u[o]&&u[o],l=i.i||{},a=i.cache||{},f="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,r){if(!a[t]){if(!e[t]){if(n[t])return n[t];var l="function"==typeof u[o]&&u[o];if(!r&&l)return l(t,!0);if(i)return i(t,!0);if(f&&"string"==typeof t)return f(t);var d=Error("Cannot find module '"+t+"'");throw d.code="MODULE_NOT_FOUND",d}p.resolve=function(r){var o=e[t][1][r];return null!=o?o:r},p.cache={};var s=a[t]=new c.Module(t);e[t][0].call(s.exports,p,s,s.exports,u)}return a[t].exports;function p(e){var t=p.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=c(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 c(t)}}c.isParcelRequire=!0,c.Module=function(e){this.id=e,this.bundle=c,this.require=f,this.exports={}},c.modules=e,c.cache=a,c.parent=i,c.distDir=void 0,c.publicUrl=void 0,c.devServer=void 0,c.i=l,c.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(c,"root",{get:function(){return u[o]}}),u[o]=c;for(var d=0;d<t.length;d++)c(t[d]);if(r){var s=c(r);"object"==typeof exports&&"u">typeof module?module.exports=s:"function"==typeof define&&define.amd&&define(function(){return s})}}({"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",{});
|
||||
!function(e,t){"object"===typeof exports&&"undefined"!==typeof module?module.exports=t():"function"==typeof define&&define.amd?(t.ArtplayerPluginAutoThumbnail=t(),define(function(){return t.ArtplayerPluginAutoThumbnail})):(e="undefined"!==typeof globalThis?globalThis:e||self).ArtplayerPluginAutoThumbnail=t()}(this,function(){"use strict";function e(e){return async t=>(t.on("video:loadedmetadata",()=>{const n=e.url||t.option.url,o=e.width||160,i=e.number||100,u=e.scale||1;!function({url:e,width:t,number:n},o){const i=document.createElement("video");i.crossOrigin="anonymous",i.src=e,i.onloadedmetadata=()=>{const e=i.duration,u=document.createElement("canvas"),a=u.getContext("2d"),d=Math.floor(t*i.videoHeight/i.videoWidth);u.width=10*t,u.height=d*Math.ceil(n/10);let l=null;!function r(c){u.toBlob(e=>{URL.revokeObjectURL(l),l=URL.createObjectURL(e),o({url:l,height:d})},"image/jpeg"),c>=n||(i.currentTime=e*c/n,i.onseeked=()=>{a.drawImage(i,c%10*t,Math.floor(c/10)*d,t,d),r(c+1)})}(0)}}({url:n,width:o,number:i},e=>{t.thumbnails={...e,column:10,number:i,width:o,scale:u}})}),{name:"artplayerPluginAutoThumbnail"})}return"undefined"!==typeof window&&(window.artplayerPluginAutoThumbnail=e),e});
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-auto-thumbnail.js v1.0.1
|
||||
* artplayer-plugin-auto-thumbnail.js v1.0.2
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,n,o){var u="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},c="function"==typeof u[n]&&u[n],i=c.i||{},a=c.cache||{},l="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function s(t,r){if(!a[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(c)return c(t,!0);if(l&&"string"==typeof t)return l(t);var f=Error("Cannot find module '"+t+"'");throw f.code="MODULE_NOT_FOUND",f}d.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},d.cache={};var p=a[t]=new s.Module(t);e[t][0].call(p.exports,d,p,p.exports,u)}return a[t].exports;function d(e){var t=d.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=s(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 s(t)}}s.isParcelRequire=!0,s.Module=function(e){this.id=e,this.bundle=s,this.require=l,this.exports={}},s.modules=e,s.cache=a,s.parent=c,s.distDir=void 0,s.publicUrl=void 0,s.devServer=void 0,s.i=i,s.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(s,"root",{get:function(){return u[n]}}),u[n]=s;for(var f=0;f<t.length;f++)s(t[f]);if(r){var p=s(r);"object"==typeof exports&&"u">typeof module?module.exports=p:"function"==typeof define&&define.amd&&define(function(){return p})}}({"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;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){o._(e,t,r[t])})}return e}},{"9f9b8a24218ee51e":"ltU3W"}],ltU3W:[function(e,t,r,n){"use strict";r._=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},{}],"3G1wX":[function(e,t,r,n){"use strict";r._=function(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}},{}],eltGh:[function(e,t,r,n){"use strict";r._=function(e,t){var r,n,o,u={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:a(0)}),i(c,"throw",{value:a(1)}),i(c,"return",{value:a(2)}),"function"==typeof Symbol&&i(c,SLine truncated
|
||||
!function(e,t){"object"===typeof exports&&"undefined"!==typeof module?module.exports=t():"function"==typeof define&&define.amd?(t.ArtplayerPluginAutoThumbnail=t(),define(function(){return t.ArtplayerPluginAutoThumbnail})):(e="undefined"!==typeof globalThis?globalThis:e||self).ArtplayerPluginAutoThumbnail=t()}(this,function(){"use strict";var e=Object.defineProperty,t=Object.defineProperties,n=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,a=(t,n,r)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r;function l(e){return l=>{return u=null,c=null,d=function*(){return l.on("video:loadedmetadata",()=>{const u=e.url||l.option.url,c=e.width||160,d=e.number||100,s=e.scale||1;!function({url:e,width:t,number:n},r){const o=document.createElement("video");o.crossOrigin="anonymous",o.src=e,o.onloadedmetadata=()=>{const e=o.duration,i=document.createElement("canvas"),a=i.getContext("2d"),l=Math.floor(t*o.videoHeight/o.videoWidth);i.width=10*t,i.height=l*Math.ceil(n/10);let u=null;!function c(d){i.toBlob(e=>{URL.revokeObjectURL(u),u=URL.createObjectURL(e),r({url:u,height:l})},"image/jpeg"),d>=n||(o.currentTime=e*d/n,o.onseeked=()=>{a.drawImage(o,d%10*t,Math.floor(d/10)*l,t,l),c(d+1)})}(0)}}({url:u,width:c,number:d},e=>{var u;l.thumbnails=(u=((e,t)=>{for(var n in t||(t={}))o.call(t,n)&&a(e,n,t[n]);if(r)for(var n of r(t))i.call(t,n)&&a(e,n,t[n]);return e})({},e),t(u,n({column:10,number:d,width:c,scale:s})))})}),{name:"artplayerPluginAutoThumbnail"}},new Promise((e,t)=>{var n=e=>{try{o(d.next(e))}catch(n){t(n)}},r=e=>{try{o(d.throw(e))}catch(n){t(n)}},o=t=>t.done?e(t.value):Promise.resolve(t.value).then(n,r);o((d=d.apply(u,c)).next())});var u,c,d}}return"undefined"!==typeof window&&(window.artplayerPluginAutoThumbnail=l),l});
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-auto-thumbnail.js v1.0.1
|
||||
* artplayer-plugin-auto-thumbnail.js v1.0.2
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,o,n){var u="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},i="function"==typeof u[o]&&u[o],l=i.i||{},a=i.cache||{},f="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,r){if(!a[t]){if(!e[t]){if(n[t])return n[t];var l="function"==typeof u[o]&&u[o];if(!r&&l)return l(t,!0);if(i)return i(t,!0);if(f&&"string"==typeof t)return f(t);var d=Error("Cannot find module '"+t+"'");throw d.code="MODULE_NOT_FOUND",d}p.resolve=function(r){var o=e[t][1][r];return null!=o?o:r},p.cache={};var s=a[t]=new c.Module(t);e[t][0].call(s.exports,p,s,s.exports,u)}return a[t].exports;function p(e){var t=p.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=c(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 c(t)}}c.isParcelRequire=!0,c.Module=function(e){this.id=e,this.bundle=c,this.require=f,this.exports={}},c.modules=e,c.cache=a,c.parent=i,c.distDir=void 0,c.publicUrl=void 0,c.devServer=void 0,c.i=l,c.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(c,"root",{get:function(){return u[o]}}),u[o]=c;for(var d=0;d<t.length;d++)c(t[d]);if(r){var s=c(r);"object"==typeof exports&&"u">typeof module?module.exports=s:"function"==typeof define&&define.amd&&define(function(){return s})}}({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};
|
||||
function e(e){return async t=>(t.on("video:loadedmetadata",()=>{const n=e.url||t.option.url,o=e.width||160,a=e.number||100,i=e.scale||1;!function({url:e,width:t,number:n},o){const a=document.createElement("video");a.crossOrigin="anonymous",a.src=e,a.onloadedmetadata=()=>{const e=a.duration,i=document.createElement("canvas"),r=i.getContext("2d"),u=Math.floor(t*a.videoHeight/a.videoWidth);i.width=10*t,i.height=u*Math.ceil(n/10);let d=null;!function l(c){i.toBlob(e=>{URL.revokeObjectURL(d),d=URL.createObjectURL(e),o({url:d,height:u})},"image/jpeg"),c>=n||(a.currentTime=e*c/n,a.onseeked=()=>{r.drawImage(a,c%10*t,Math.floor(c/10)*u,t,u),l(c+1)})}(0)}}({url:n,width:o,number:a},e=>{t.thumbnails={...e,column:10,number:a,width:o,scale:i}})}),{name:"artplayerPluginAutoThumbnail"})}"undefined"!==typeof window&&(window.artplayerPluginAutoThumbnail=e);export{e as default};
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "artplayer-plugin-auto-thumbnail",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"description": "auto-thumbnail plugin for ArtPlayer",
|
||||
"author": "Harvey Zhao <laozhaochaguan@gmail.com>",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-chapter.js v1.0.2
|
||||
* artplayer-plugin-chapter.js v1.0.3
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(t,e,r,a,n){var o="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},i="function"==typeof o[a]&&o[a],l=i.i||{},d=i.cache||{},p="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function s(e,r){if(!d[e]){if(!t[e]){if(n[e])return n[e];var l="function"==typeof o[a]&&o[a];if(!r&&l)return l(e,!0);if(i)return i(e,!0);if(p&&"string"==typeof e)return p(e);var u=Error("Cannot find module '"+e+"'");throw u.code="MODULE_NOT_FOUND",u}f.resolve=function(r){var a=t[e][1][r];return null!=a?a:r},f.cache={};var c=d[e]=new s.Module(e);t[e][0].call(c.exports,f,c,c.exports,o)}return d[e].exports;function f(t){var e=f.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=s(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 s(e)}}s.isParcelRequire=!0,s.Module=function(t){this.id=t,this.bundle=s,this.require=p,this.exports={}},s.modules=t,s.cache=d,s.parent=i,s.distDir=void 0,s.publicUrl=void 0,s.devServer=void 0,s.i=l,s.register=function(e,r){t[e]=[function(t,e){e.exports=r},{}]},Object.defineProperty(s,"root",{get:function(){return o[a]}}),o[a]=s;for(var u=0;u<e.length;u++)s(e[u]);if(r){var c=s(r);"object"==typeof exports&&"u">typeof module?module.exports=c:"function"==typeof define&&define.amd&&define(function(){return c})}}({"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=`<div class="art-chapter"><div class="art-chapter-inner"><div class="art-progress-hover"></div><div class="art-progress-loaded"></div><div class="art-progress-played"></div></div></div>`,s=[],u=e.query(".art-control-progress-inner"),c=n(u,'<div class="art-chapters"></div>'),f=n(u,'<div class="art-chapter-title"></div>');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;r<t.length;r++){let a=t[r],n=t[r+1];if(a.end===1/0&&(a.end=e.duration),"number"!=typeof a.start||"number"!=typeof a.end||"string"!=typeof a.title)throw TypeError("Illegal chapter data type");if(a.start<0||a.end>e.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<e.duration&&t.push({start:t[t.length-1].end,end:e.duration,title:""});for(let e=0;e<t.length-1;e++)t[e].end!==t[e+1].start&&t.splice(e+1,0,{start:t[e].end,end:t[e+1].start,title:""});s=t.map(t=>{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;n<s.length;n++){let{$chapter:o,$loaded:i,$played:l,$hover:d}=s[n],p={hover:d,loaded:i,played:l}[t];if(!p)return;let h=c.clientWidth*r,g=e.duration*r,y=Number.parseFloat(o.dataset.duration),m=Number.parseFloat(o.dataset.start),v=Number.parseFloat(o.dataset.end);if(g<m&&a(p,"width",0),g>v&&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-chaptLine truncated
|
||||
!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.ArtplayerPluginChapter=e(),define(function(){return t.ArtplayerPluginChapter})):(t="undefined"!==typeof globalThis?globalThis:t||self).ArtplayerPluginChapter=e()}(this,function(){"use strict";function t(t={}){return e=>{const{$player:r}=e.template,{setStyle:a,append:n,clamp:o,query:i,addClass:p,removeClass:d}=e.constructor.utils;let s=[];const l=e.query(".art-control-progress-inner"),c=n(l,'<div class="art-chapters"></div>'),h=n(l,'<div class="art-chapter-title"></div>');function u({$chapter:t,width:e}){const r=t.dataset.title.trim();if(r){h.textContent=r;const t=h.clientWidth;e<=t/2?a(h,"left",0):e>l.clientWidth-t/2?a(h,"left",l.clientWidth-t+"px"):a(h,"left",e-t/2+"px")}}function g(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;r<t.length;r++){const a=t[r],n=t[r+1];if(a.end===1/0&&(a.end=e.duration),"number"!==typeof a.start||"number"!==typeof a.end||"string"!==typeof a.title)throw new TypeError("Illegal chapter data type");if(a.start<0||a.end>e.duration||a.start>=a.end)throw new Error("Illegal chapter time point");if(n&&a.end>n.start)throw new Error("Illegal chapter time point")}t[0].start>0&&t.unshift({start:0,end:t[0].start,title:""}),t[t.length-1].end<e.duration&&t.push({start:t[t.length-1].end,end:e.duration,title:""});for(let e=0;e<t.length-1;e++)t[e].end!==t[e+1].start&&t.splice(e+1,0,{start:t[e].end,end:t[e+1].start,title:""});s=t.map(t=>{const r=n(c,'\n <div class="art-chapter">\n <div class="art-chapter-inner">\n <div class="art-progress-hover"></div>\n <div class="art-progress-loaded"></div>\n <div class="art-progress-played"></div>\n </div>\n </div>\n '),a=o(t.start,0,e.duration),p=o(t.end,0,e.duration),d=p-a,s=d/e.duration;return r.dataset.start=a,r.dataset.end=p,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)}}),p(r,"artplayer-plugin-chapter"),e.emit("setBar","loaded",e.loaded||0)}}return e.on("setBar",(t,r)=>{if(s.length)for(let n=0;n<s.length;n++){const{$chapter:o,$loaded:i,$played:p,$hover:d}=s[n],l={hover:d,loaded:i,played:p}[t];if(!l)return;const h=c.clientWidth*r,g=e.duration*r,y=Number.parseFloat(o.dataset.duration),f=Number.parseFloat(o.dataset.start),m=Number.parseFloat(o.dataset.end);if(g<f&&a(l,"width",0),g>m&&a(l,"width","100%"),g>=f&&g<=m){a(l,"width",100*((g-f)/y)+"%"),"hover"===t&&h>0&&u({$chapter:o,width:h})}}}),e.once("video:loadedmetadata",()=>g(t.chapters)),{name:"artplayerPluginChapter",update:({chapters:t})=>g(t)}}}if("undefined"!==typeof document){const t="artplayer-plugin-chapter";let e=document.getElementById(t);e||(e=document.createElement("style"),e.id=t,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{document.head.appendChild(e)}):(document.head||document.documentElement).appendChild(e)),e.textContent=".artplayer-plugin-chapter .art-control-progress-inner{height:100%!important;background-color:transparent!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{position:absolute;z-index:0;inset:0;display:flex;align-items:center;gap:4px;height:100%;transform:scaleY(1.25)}.artplayer-plugin-chapter .art-chapters .art-chapter{display:flex;align-items:center;height:100%}.artplayer-plugin-chapter .art-chapters .art-chapter .art-chapter-inner{position:relative;cursor:pointer;width:100%;height:50%;border-radius:10px;overflow:hidden;transition:height var(--art-transition-duration) ease;background-color:var(--art-progress-color)}.artplayer-plugin-chapter .art-chapters .art-chapter:hover .art-chapter-inner{height:100%}.artplayer-plugin-chapter .art-chapter-title{transform-origin:bottom center;transform:scale(.5);opacity:0;position:absolute;z-index:70;top:-50px;left:0;padding:3px 5px;line-height:1;font-size:14px;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}.artplayer-plugin-chapter.art-progress-hover .art-chapter-title{transform:scale(1);opacity:1}"}return"undefined"!==typeof window&&(window.artplayerPluginChapter=t),t});
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-chapter.js v1.0.2
|
||||
* artplayer-plugin-chapter.js v1.0.3
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(t,e,r,a,n){var o="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},i="function"==typeof o[a]&&o[a],l=i.i||{},p=i.cache||{},d="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function s(e,r){if(!p[e]){if(!t[e]){if(n[e])return n[e];var l="function"==typeof o[a]&&o[a];if(!r&&l)return l(e,!0);if(i)return i(e,!0);if(d&&"string"==typeof e)return d(e);var u=Error("Cannot find module '"+e+"'");throw u.code="MODULE_NOT_FOUND",u}f.resolve=function(r){var a=t[e][1][r];return null!=a?a:r},f.cache={};var c=p[e]=new s.Module(e);t[e][0].call(c.exports,f,c,c.exports,o)}return p[e].exports;function f(t){var e=f.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=s(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 s(e)}}s.isParcelRequire=!0,s.Module=function(t){this.id=t,this.bundle=s,this.require=d,this.exports={}},s.modules=t,s.cache=p,s.parent=i,s.distDir=void 0,s.publicUrl=void 0,s.devServer=void 0,s.i=l,s.register=function(e,r){t[e]=[function(t,e){e.exports=r},{}]},Object.defineProperty(s,"root",{get:function(){return o[a]}}),o[a]=s;for(var u=0;u<e.length;u++)s(e[u]);if(r){var c=s(r);"object"==typeof exports&&"u">typeof module?module.exports=c:"function"==typeof define&&define.amd&&define(function(){return c})}}({"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,'<div class="art-chapters"></div>'),f=o(u,'<div class="art-chapter-title"></div>');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;a<t.length;a++){var n=t[a],u=t[a+1];if(n.end===1/0&&(n.end=e.duration),"number"!=typeof n.start||"number"!=typeof n.end||"string"!=typeof n.title)throw TypeError("Illegal chapter data type");if(n.start<0||n.end>e.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<e.duration&&t.push({start:t[t.length-1].end,end:e.duration,title:""});for(var f=0;f<t.length-1;f++)t[f].end!==t[f+1].start&&t.splice(f+1,0,{start:t[f].end,end:t[f+1].start,title:""});s=t.map(function(t){var r=o(c,'\n <div class="art-chapter">\n<div class="art-chapter-inner">\n<div class="art-progress-hover"></div>\n<div class="art-progress-loaded"></div>\n<div class="art-progress-played"></div>\n</div>\n</div>\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;a<s.length;a++){var o=s[a],i=o.$chapter,l=o.$loaded,p=o.$played,d={hover:o.$hover,loaded:l,played:p}[t];if(!d)return;var h=c.clientWidth*r,g=e.duration*r,y=Number.parseFloat(i.dataset.duration),v=Number.parseFloat(i.dataset.start),m=Number.parseFloat(i.dataset.end);if(g<v&&n(d,"width",0),g>m&&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/srcLine truncated
|
||||
!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.ArtplayerPluginChapter=e(),define(function(){return t.ArtplayerPluginChapter})):(t="undefined"!==typeof globalThis?globalThis:t||self).ArtplayerPluginChapter=e()}(this,function(){"use strict";function t(t={}){return e=>{const{$player:r}=e.template,{setStyle:a,append:n,clamp:o,query:i,addClass:p,removeClass:d}=e.constructor.utils;let s=[];const l=e.query(".art-control-progress-inner"),c=n(l,'<div class="art-chapters"></div>'),h=n(l,'<div class="art-chapter-title"></div>');function u({$chapter:t,width:e}){const r=t.dataset.title.trim();if(r){h.textContent=r;const t=h.clientWidth;e<=t/2?a(h,"left",0):e>l.clientWidth-t/2?a(h,"left",l.clientWidth-t+"px"):a(h,"left",e-t/2+"px")}}function g(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;r<t.length;r++){const a=t[r],n=t[r+1];if(a.end===1/0&&(a.end=e.duration),"number"!==typeof a.start||"number"!==typeof a.end||"string"!==typeof a.title)throw new TypeError("Illegal chapter data type");if(a.start<0||a.end>e.duration||a.start>=a.end)throw new Error("Illegal chapter time point");if(n&&a.end>n.start)throw new Error("Illegal chapter time point")}t[0].start>0&&t.unshift({start:0,end:t[0].start,title:""}),t[t.length-1].end<e.duration&&t.push({start:t[t.length-1].end,end:e.duration,title:""});for(let e=0;e<t.length-1;e++)t[e].end!==t[e+1].start&&t.splice(e+1,0,{start:t[e].end,end:t[e+1].start,title:""});s=t.map(t=>{const r=n(c,'\n <div class="art-chapter">\n <div class="art-chapter-inner">\n <div class="art-progress-hover"></div>\n <div class="art-progress-loaded"></div>\n <div class="art-progress-played"></div>\n </div>\n </div>\n '),a=o(t.start,0,e.duration),p=o(t.end,0,e.duration),d=p-a,s=d/e.duration;return r.dataset.start=a,r.dataset.end=p,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)}}),p(r,"artplayer-plugin-chapter"),e.emit("setBar","loaded",e.loaded||0)}}return e.on("setBar",(t,r)=>{if(s.length)for(let n=0;n<s.length;n++){const{$chapter:o,$loaded:i,$played:p,$hover:d}=s[n],l={hover:d,loaded:i,played:p}[t];if(!l)return;const h=c.clientWidth*r,g=e.duration*r,y=Number.parseFloat(o.dataset.duration),f=Number.parseFloat(o.dataset.start),m=Number.parseFloat(o.dataset.end);if(g<f&&a(l,"width",0),g>m&&a(l,"width","100%"),g>=f&&g<=m){a(l,"width",100*((g-f)/y)+"%"),"hover"===t&&h>0&&u({$chapter:o,width:h})}}}),e.once("video:loadedmetadata",()=>g(t.chapters)),{name:"artplayerPluginChapter",update:({chapters:t})=>g(t)}}}if("undefined"!==typeof document){const t="artplayer-plugin-chapter";let e=document.getElementById(t);e||(e=document.createElement("style"),e.id=t,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{document.head.appendChild(e)}):(document.head||document.documentElement).appendChild(e)),e.textContent=".artplayer-plugin-chapter .art-control-progress-inner{height:100%!important;background-color:transparent!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{position:absolute;z-index:0;inset:0;display:flex;align-items:center;gap:4px;height:100%;transform:scaleY(1.25)}.artplayer-plugin-chapter .art-chapters .art-chapter{display:flex;align-items:center;height:100%}.artplayer-plugin-chapter .art-chapters .art-chapter .art-chapter-inner{position:relative;cursor:pointer;width:100%;height:50%;border-radius:10px;overflow:hidden;transition:height var(--art-transition-duration) ease;background-color:var(--art-progress-color)}.artplayer-plugin-chapter .art-chapters .art-chapter:hover .art-chapter-inner{height:100%}.artplayer-plugin-chapter .art-chapter-title{transform-origin:bottom center;transform:scale(.5);opacity:0;position:absolute;z-index:70;top:-50px;left:0;padding:3px 5px;line-height:1;font-size:14px;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}.artplayer-plugin-chapter.art-progress-hover .art-chapter-title{transform:scale(1);opacity:1}"}return"undefined"!==typeof window&&(window.artplayerPluginChapter=t),t});
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-chapter.js v1.0.2
|
||||
* artplayer-plugin-chapter.js v1.0.3
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,a,n){var o="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},i="function"==typeof o[a]&&o[a],l=i.i||{},d=i.cache||{},p="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function s(t,r){if(!d[t]){if(!e[t]){if(n[t])return n[t];var l="function"==typeof o[a]&&o[a];if(!r&&l)return l(t,!0);if(i)return i(t,!0);if(p&&"string"==typeof t)return p(t);var u=Error("Cannot find module '"+t+"'");throw u.code="MODULE_NOT_FOUND",u}f.resolve=function(r){var a=e[t][1][r];return null!=a?a:r},f.cache={};var c=d[t]=new s.Module(t);e[t][0].call(c.exports,f,c,c.exports,o)}return d[t].exports;function f(e){var t=f.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=s(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 s(t)}}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=i,s.distDir=void 0,s.publicUrl=void 0,s.devServer=void 0,s.i=l,s.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(s,"root",{get:function(){return o[a]}}),o[a]=s;for(var u=0;u<t.length;u++)s(t[u]);if(r){var c=s(r);"object"==typeof exports&&"u">typeof module?module.exports=c:"function"==typeof define&&define.amd&&define(function(){return c})}}({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=`<div class="art-chapter"><div class="art-chapter-inner"><div class="art-progress-hover"></div><div class="art-progress-loaded"></div><div class="art-progress-played"></div></div></div>`,s=[],u=t.query(".art-control-progress-inner"),c=n(u,'<div class="art-chapters"></div>'),f=n(u,'<div class="art-chapter-title"></div>');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;r<e.length;r++){let a=e[r],n=e[r+1];if(a.end===1/0&&(a.end=t.duration),"number"!=typeof a.start||"number"!=typeof a.end||"string"!=typeof a.title)throw TypeError("Illegal chapter data type");if(a.start<0||a.end>t.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<t.duration&&e.push({start:e[e.length-1].end,end:t.duration,title:""});for(let t=0;t<e.length-1;t++)e[t].end!==e[t+1].start&&e.splice(t+1,0,{start:e[t].end,end:e[t+1].start,title:""});s=e.map(e=>{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;n<s.length;n++){let{$chapter:o,$loaded:i,$played:l,$hover:d}=s[n],p={hover:d,loaded:i,played:l}[e];if(!p)return;let h=c.clientWidth*r,g=t.duration*r,y=Number.parseFloat(o.dataset.duration),m=Number.parseFloat(o.dataset.start),v=Number.parseFloat(o.dataset.end);if(g<m&&a(p,"width",0),g>v&&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-chapterLine truncated
|
||||
function t(t={}){return r=>{const{$player:e}=r.template,{setStyle:a,append:n,clamp:o,query:i,addClass:p,removeClass:d}=r.constructor.utils;let s=[];const l=r.query(".art-control-progress-inner"),c=n(l,'<div class="art-chapters"></div>'),h=n(l,'<div class="art-chapter-title"></div>');function u({$chapter:t,width:r}){const e=t.dataset.title.trim();if(e){h.textContent=e;const t=h.clientWidth;r<=t/2?a(h,"left",0):r>l.clientWidth-t/2?a(h,"left",l.clientWidth-t+"px"):a(h,"left",r-t/2+"px")}}function g(t=[]){if(s=[],c.textContent="",d(e,"artplayer-plugin-chapter"),Array.isArray(t)&&t.length&&r.duration){t=t.sort((t,r)=>t.start-r.start);for(let e=0;e<t.length;e++){const a=t[e],n=t[e+1];if(a.end===1/0&&(a.end=r.duration),"number"!==typeof a.start||"number"!==typeof a.end||"string"!==typeof a.title)throw new TypeError("Illegal chapter data type");if(a.start<0||a.end>r.duration||a.start>=a.end)throw new Error("Illegal chapter time point");if(n&&a.end>n.start)throw new Error("Illegal chapter time point")}t[0].start>0&&t.unshift({start:0,end:t[0].start,title:""}),t[t.length-1].end<r.duration&&t.push({start:t[t.length-1].end,end:r.duration,title:""});for(let r=0;r<t.length-1;r++)t[r].end!==t[r+1].start&&t.splice(r+1,0,{start:t[r].end,end:t[r+1].start,title:""});s=t.map(t=>{const e=n(c,'\n <div class="art-chapter">\n <div class="art-chapter-inner">\n <div class="art-progress-hover"></div>\n <div class="art-progress-loaded"></div>\n <div class="art-progress-played"></div>\n </div>\n </div>\n '),a=o(t.start,0,r.duration),p=o(t.end,0,r.duration),d=p-a,s=d/r.duration;return e.dataset.start=a,e.dataset.end=p,e.dataset.duration=d,e.dataset.title=t.title.trim(),e.style.width=100*s+"%",{$chapter:e,$hover:i(".art-progress-hover",e),$loaded:i(".art-progress-loaded",e),$played:i(".art-progress-played",e)}}),p(e,"artplayer-plugin-chapter"),r.emit("setBar","loaded",r.loaded||0)}}return r.on("setBar",(t,e)=>{if(s.length)for(let n=0;n<s.length;n++){const{$chapter:o,$loaded:i,$played:p,$hover:d}=s[n],l={hover:d,loaded:i,played:p}[t];if(!l)return;const h=c.clientWidth*e,g=r.duration*e,y=Number.parseFloat(o.dataset.duration),m=Number.parseFloat(o.dataset.start),f=Number.parseFloat(o.dataset.end);if(g<m&&a(l,"width",0),g>f&&a(l,"width","100%"),g>=m&&g<=f){a(l,"width",100*((g-m)/y)+"%"),"hover"===t&&h>0&&u({$chapter:o,width:h})}}}),r.once("video:loadedmetadata",()=>g(t.chapters)),{name:"artplayerPluginChapter",update:({chapters:t})=>g(t)}}}if("undefined"!==typeof document){const t="artplayer-plugin-chapter";let r=document.getElementById(t);r||(r=document.createElement("style"),r.id=t,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{document.head.appendChild(r)}):(document.head||document.documentElement).appendChild(r)),r.textContent=".artplayer-plugin-chapter .art-control-progress-inner{height:100%!important;background-color:transparent!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{position:absolute;z-index:0;inset:0;display:flex;align-items:center;gap:4px;height:100%;transform:scaleY(1.25)}.artplayer-plugin-chapter .art-chapters .art-chapter{display:flex;align-items:center;height:100%}.artplayer-plugin-chapter .art-chapters .art-chapter .art-chapter-inner{position:relative;cursor:pointer;width:100%;height:50%;border-radius:10px;overflow:hidden;transition:height var(--art-transition-duration) ease;background-color:var(--art-progress-color)}.artplayer-plugin-chapter .art-chapters .art-chapter:hover .art-chapter-inner{height:100%}.artplayer-plugin-chapter .art-chapter-title{transform-origin:bottom center;transform:scale(.5);opacity:0;position:absolute;z-index:70;top:-50px;left:0;padding:3px 5px;line-height:1;font-size:14px;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}.artplayer-plugin-chapter.art-progress-hover .art-chapter-title{transform:scale(1);opacity:1}"}"undefined"!==typeof window&&(window.artplayerPluginChapter=t);export{t as default};
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "artplayer-plugin-chapter",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"description": "chapter plugin for ArtPlayer",
|
||||
"author": "Harvey Zhao <laozhaochaguan@gmail.com>",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import style from 'bundle-text:./style.less'
|
||||
import style from './style.less?inline'
|
||||
|
||||
export default function artplayerPluginChapter(option = {}) {
|
||||
return (art) => {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-chromecast.js v1.0.1
|
||||
* artplayer-plugin-chromecast.js v1.0.2
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,o,n,r){var a="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},i="function"==typeof a[n]&&a[n],c=i.i||{},s=i.cache||{},l="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,o){if(!s[t]){if(!e[t]){if(r[t])return r[t];var c="function"==typeof a[n]&&a[n];if(!o&&c)return c(t,!0);if(i)return i(t,!0);if(l&&"string"==typeof t)return l(t);var u=Error("Cannot find module '"+t+"'");throw u.code="MODULE_NOT_FOUND",u}p.resolve=function(o){var n=e[t][1][o];return null!=n?n:o},p.cache={};var f=s[t]=new d.Module(t);e[t][0].call(f.exports,p,f,f.exports,a)}return s[t].exports;function p(e){var t=p.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=d(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 d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.require=l,this.exports={}},d.modules=e,d.cache=s,d.parent=i,d.distDir=void 0,d.publicUrl=void 0,d.devServer=void 0,d.i=c,d.register=function(t,o){e[t]=[function(e,t){t.exports=o},{}]},Object.defineProperty(d,"root",{get:function(){return a[n]}}),a[n]=d;for(var u=0;u<t.length;u++)d(t[u]);if(o){var f=d(o);"object"==typeof exports&&"u">typeof module?module.exports=f:"function"==typeof define&&define.amd&&define(function(){return f})}}({"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:`<i class="art-icon art-icon-cast">${e.icon||'<svg height="20" width="20" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M512 96H64v99c-13-2-26.4-3-40-3H0V96C0 60.7 28.7 32 64 32H512c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H288V456c0-13.6-1-27-3-40H512V96zM24 224c128.1 0 232 103.9 232 232c0 13.3-10.7 24-24 24s-24-10.7-24-24c0-101.6-82.4-184-184-184c-13.3 0-24-10.7-24-24s10.7-24 24-24zm8 192a32 32 0 1 1 0 64 32 32 0 1 1 0-64zM0 344c0-13.3 10.7-24 24-24c75.1 0 136 60.9 136 136c0 13.3-10.7 24-24 24s-24-10.7-24-24c0-48.6-39.4-88-88-88c-13.3 0-24-10.7-24-24z"/></svg>'}</i>`,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.Line truncated
|
||||
!function(e,t){"object"===typeof exports&&"undefined"!==typeof module?module.exports=t():"function"==typeof define&&define.amd?(t.ArtplayerPluginChromecast=t(),define(function(){return t.ArtplayerPluginChromecast})):(e="undefined"!==typeof globalThis?globalThis:e||self).ArtplayerPluginChromecast=t()}(this,function(){"use strict";function e(e){let t=!1,o=null,n=null;const a=e=>{const 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"}},c=()=>new Promise((c,s)=>{var i;window.__onGCastApiAvailable=i=>{if(i){const 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,t=>{const c=window.cast.framework.SessionState;switch(n=t.sessionState,o=t.session,t.sessionState){case c.NO_SESSION:e.onStateChange?.("disconnected"),a("disconnected");break;case c.SESSION_STARTING:e.onStateChange?.("connecting"),a("connecting");break;case c.SESSION_STARTED:e.onStateChange?.("connected"),a("connected");break;case c.SESSION_ENDING:e.onStateChange?.("disconnecting"),a("disconnecting");break;case c.SESSION_RESUMED:e.onStateChange?.("connected"),a("connected")}}),s.addEventListener(window.cast.framework.CastContextEventType.CAST_STATE_CHANGED,t=>{const 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,c()}else s(new 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((e,t)=>{const o=document.createElement("script");o.src=i,o.onload=e,o.onerror=t,document.body.appendChild(o)})).catch(s)}),s=(t,o)=>{const n=e.url||t.option.url,a=new window.chrome.cast.media.MediaInfo(n,e.mimeType||function(e){return{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"}[e.split("?")[0].split("#")[0].split(".").pop().toLowerCase()]||"application/octet-stream"}(n)),c=new window.chrome.cast.media.LoadRequest(a);o.loadMedia(c).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:`<i class="art-icon art-icon-cast">${e.icon||'<svg height="20" width="20" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M512 96H64v99c-13-2-26.4-3-40-3H0V96C0 60.7 28.7 32 64 32H512c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H288V456c0-13.6-1-27-3-40H512V96zM24 224c128.1 0 232 103.9 232 232c0 13.3-10.7 24-24 24s-24-10.7-24-24c0-101.6-82.4-184-184-184c-13.3 0-24-10.7-24-24s10.7-24 24-24zm8 192a32 32 0 1 1 0 64 32 32 0 1 1 0-64zM0 344c0-13.3 10.7-24 24-24c75.1 0 136 60.9 136 136c0 13.3-10.7 24-24 24s-24-10.7-24-24c0-48.6-39.4-88-88-88c-13.3 0-24-10.7-24-24z"/></svg>'}</i>`,click:async()=>{if(!t)try{await c()}catch(i){throw a.notice.show="Failed to initialize Cast API",e.onError?.(i),i}const n=window.cast.framework.CastContext.getInstance();if(o)s(a,o);else try{const e=await n.requestSession();s(a,e)}catch(i){throw a.notice.show="Error connecting to cast session",e.onError?.(i),i}}}),{name:"artplayerPluginChromecast",getCastState:()=>n,isCasting:()=>null!==o})}return"undefined"!==typeof window&&(window.artplayerPluginChromecast=e),e});
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-chromecast.js v1.0.1
|
||||
* artplayer-plugin-chromecast.js v1.0.2
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,r,o){var a="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},c="function"==typeof a[r]&&a[r],i=c.i||{},s=c.cache||{},l="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(t,n){if(!s[t]){if(!e[t]){if(o[t])return o[t];var i="function"==typeof a[r]&&a[r];if(!n&&i)return i(t,!0);if(c)return c(t,!0);if(l&&"string"==typeof t)return l(t);var f=Error("Cannot find module '"+t+"'");throw f.code="MODULE_NOT_FOUND",f}p.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},p.cache={};var d=s[t]=new u.Module(t);e[t][0].call(d.exports,p,d,d.exports,a)}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],r=e[1],o=e[2]||e[0],a=u(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 u(t)}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.require=l,this.exports={}},u.modules=e,u.cache=s,u.parent=c,u.distDir=void 0,u.publicUrl=void 0,u.devServer=void 0,u.i=i,u.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(u,"root",{get:function(){return a[r]}}),a[r]=u;for(var f=0;f<t.length;f++)u(t[f]);if(n){var d=u(n);"object"==typeof exports&&"u">typeof module?module.exports=d:"function"==typeof define&&define.amd&&define(function(){return d})}}({"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:'<i class="art-icon art-icon-cast">'.concat(e.icon||'<svg height="20" width="20" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M512 96H64v99c-13-2-26.4-3-40-3H0V96C0 60.7 28.7 32 64 32H512c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H288V456c0-13.6-1-27-3-40H512V96zM24 224c128.1 0 232 103.9 232 232c0 13.3-10.7 24-24 24s-24-10.7-24-24c0-101.6-82.4-184-184-184c-13.3 0-24-10.7-24-24s10.7-24 24-24zm8 192a32 32 0 1 1 0 64 32 32 0 1 1 0-64zM0 344c0-13.3 10.7-24 24-24c75.1 0 136 60.9 136 136c0 13.3-10.7 24-24 24s-24-10.7-24-24c0-48.6-39.4-88-88-88c-13.3 0-24-10.7-24-24z"/></svg>',"</i>"),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_AVAILABLELine truncated
|
||||
!function(e,t){"object"===typeof exports&&"undefined"!==typeof module?module.exports=t():"function"==typeof define&&define.amd?(t.ArtplayerPluginChromecast=t(),define(function(){return t.ArtplayerPluginChromecast})):(e="undefined"!==typeof globalThis?globalThis:e||self).ArtplayerPluginChromecast=t()}(this,function(){"use strict";var e=(e,t,n)=>new Promise((o,a)=>{var c=e=>{try{s(n.next(e))}catch(t){a(t)}},i=e=>{try{s(n.throw(e))}catch(t){a(t)}},s=e=>e.done?o(e.value):Promise.resolve(e.value).then(c,i);s((n=n.apply(e,t)).next())});function t(t){let n=!1,o=null,a=null;const c=e=>{const 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=()=>new Promise((e,i)=>{var s;window.__onGCastApiAvailable=s=>{if(s){const 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,e=>{var n,i,s,l,r;const d=window.cast.framework.SessionState;switch(a=e.sessionState,o=e.session,e.sessionState){case d.NO_SESSION:null==(n=t.onStateChange)||n.call(t,"disconnected"),c("disconnected");break;case d.SESSION_STARTING:null==(i=t.onStateChange)||i.call(t,"connecting"),c("connecting");break;case d.SESSION_STARTED:null==(s=t.onStateChange)||s.call(t,"connected"),c("connected");break;case d.SESSION_ENDING:null==(l=t.onStateChange)||l.call(t,"disconnecting"),c("disconnecting");break;case d.SESSION_RESUMED:null==(r=t.onStateChange)||r.call(t,"connected"),c("connected")}}),i.addEventListener(window.cast.framework.CastContextEventType.CAST_STATE_CHANGED,e=>{var n,o,a;const c=window.cast.framework.CastState;switch(e.castState){case c.NO_DEVICES_AVAILABLE:null==(n=t.onCastAvailable)||n.call(t,!1);break;case c.NOT_CONNECTED:null==(o=t.onCastAvailable)||o.call(t,!0);break;case c.CONNECTING:case c.CONNECTED:null==(a=t.onCastAvailable)||a.call(t,!0)}}),n=!0,e()}else i(new Error("Cast API is not available"))},window.chrome&&window.chrome.cast||(s=t.sdk||"https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1",new Promise((e,t)=>{const n=document.createElement("script");n.src=s,n.onload=e,n.onerror=t,document.body.appendChild(n)})).catch(i)}),s=(e,n)=>{const o=t.url||e.option.url,a=new window.chrome.cast.media.MediaInfo(o,t.mimeType||function(e){return{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"}[e.split("?")[0].split("#")[0].split(".").pop().toLowerCase()]||"application/octet-stream"}(o)),c=new window.chrome.cast.media.LoadRequest(a);n.loadMedia(c).then(()=>{var n;e.notice.show="Casting started",null==(n=t.onCastStart)||n.call(t)}).catch(n=>{var o;throw e.notice.show="Error casting media",null==(o=t.onError)||o.call(t,n),n})};return c=>e(null,null,function*(){return c.controls.add({name:"chromecast",position:"right",tooltip:"Chromecast",html:`<i class="art-icon art-icon-cast">${t.icon||'<svg height="20" width="20" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M512 96H64v99c-13-2-26.4-3-40-3H0V96C0 60.7 28.7 32 64 32H512c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H288V456c0-13.6-1-27-3-40H512V96zM24 224c128.1 0 232 103.9 232 232c0 13.3-10.7 24-24 24s-24-10.7-24-24c0-101.6-82.4-184-184-184c-13.3 0-24-10.7-24-24s10.7-24 24-24zm8 192a32 32 0 1 1 0 64 32 32 0 1 1 0-64zM0 344c0-13.3 10.7-24 24-24c75.1 0 136 60.9 136 136c0 13.3-10.7 24-24 24s-24-10.7-24-24c0-48.6-39.4-88-88-88c-13.3 0-24-10.7-24-24z"/></svg>'}</i>`,click:()=>e(null,null,function*(){var e,a;if(!n)try{yield i()}catch(r){throw c.notice.show="Failed to initialize Cast API",null==(e=t.onError)||e.call(t,r),r}const l=window.cast.framework.CastContext.getInstance();if(o)s(c,o);else try{const e=yield l.requestSession();s(c,e)}catch(r){throw c.notice.show="Error connecting to cast session",null==(a=t.onError)||a.call(t,r),r}})}),{name:"artplayerPluginChromecast",getCastState:()=>a,isCasting:()=>null!==o}})}return"undefined"!==typeof window&&(window.artplayerPluginChromecast=t),t});
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-chromecast.js v1.0.1
|
||||
* artplayer-plugin-chromecast.js v1.0.2
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,o,n,r){var a="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},i="function"==typeof a[n]&&a[n],c=i.i||{},s=i.cache||{},l="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,o){if(!s[t]){if(!e[t]){if(r[t])return r[t];var c="function"==typeof a[n]&&a[n];if(!o&&c)return c(t,!0);if(i)return i(t,!0);if(l&&"string"==typeof t)return l(t);var u=Error("Cannot find module '"+t+"'");throw u.code="MODULE_NOT_FOUND",u}p.resolve=function(o){var n=e[t][1][o];return null!=n?n:o},p.cache={};var f=s[t]=new d.Module(t);e[t][0].call(f.exports,p,f,f.exports,a)}return s[t].exports;function p(e){var t=p.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=d(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 d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.require=l,this.exports={}},d.modules=e,d.cache=s,d.parent=i,d.distDir=void 0,d.publicUrl=void 0,d.devServer=void 0,d.i=c,d.register=function(t,o){e[t]=[function(e,t){t.exports=o},{}]},Object.defineProperty(d,"root",{get:function(){return a[n]}}),a[n]=d;for(var u=0;u<t.length;u++)d(t[u]);if(o){var f=d(o);"object"==typeof exports&&"u">typeof module?module.exports=f:"function"==typeof define&&define.amd&&define(function(){return f})}}({"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:`<i class="art-icon art-icon-cast">${e.icon||'<svg height="20" width="20" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M512 96H64v99c-13-2-26.4-3-40-3H0V96C0 60.7 28.7 32 64 32H512c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H288V456c0-13.6-1-27-3-40H512V96zM24 224c128.1 0 232 103.9 232 232c0 13.3-10.7 24-24 24s-24-10.7-24-24c0-101.6-82.4-184-184-184c-13.3 0-24-10.7-24-24s10.7-24 24-24zm8 192a32 32 0 1 1 0 64 32 32 0 1 1 0-64zM0 344c0-13.3 10.7-24 24-24c75.1 0 136 60.9 136 136c0 13.3-10.7 24-24 24s-24-10.7-24-24c0-48.6-39.4-88-88-88c-13.3 0-24-10.7-24-24z"/></svg>'}</i>`,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.Line truncated
|
||||
function e(e){let t=!1,o=null,n=null;const a=e=>{const 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"}},c=()=>new Promise((c,s)=>{var i;window.__onGCastApiAvailable=i=>{if(i){const 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,t=>{const c=window.cast.framework.SessionState;switch(n=t.sessionState,o=t.session,t.sessionState){case c.NO_SESSION:e.onStateChange?.("disconnected"),a("disconnected");break;case c.SESSION_STARTING:e.onStateChange?.("connecting"),a("connecting");break;case c.SESSION_STARTED:e.onStateChange?.("connected"),a("connected");break;case c.SESSION_ENDING:e.onStateChange?.("disconnecting"),a("disconnecting");break;case c.SESSION_RESUMED:e.onStateChange?.("connected"),a("connected")}}),s.addEventListener(window.cast.framework.CastContextEventType.CAST_STATE_CHANGED,t=>{const 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,c()}else s(new 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((e,t)=>{const o=document.createElement("script");o.src=i,o.onload=e,o.onerror=t,document.body.appendChild(o)})).catch(s)}),s=(t,o)=>{const n=e.url||t.option.url,a=new window.chrome.cast.media.MediaInfo(n,e.mimeType||function(e){return{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"}[e.split("?")[0].split("#")[0].split(".").pop().toLowerCase()]||"application/octet-stream"}(n)),c=new window.chrome.cast.media.LoadRequest(a);o.loadMedia(c).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:`<i class="art-icon art-icon-cast">${e.icon||'<svg height="20" width="20" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M512 96H64v99c-13-2-26.4-3-40-3H0V96C0 60.7 28.7 32 64 32H512c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H288V456c0-13.6-1-27-3-40H512V96zM24 224c128.1 0 232 103.9 232 232c0 13.3-10.7 24-24 24s-24-10.7-24-24c0-101.6-82.4-184-184-184c-13.3 0-24-10.7-24-24s10.7-24 24-24zm8 192a32 32 0 1 1 0 64 32 32 0 1 1 0-64zM0 344c0-13.3 10.7-24 24-24c75.1 0 136 60.9 136 136c0 13.3-10.7 24-24 24s-24-10.7-24-24c0-48.6-39.4-88-88-88c-13.3 0-24-10.7-24-24z"/></svg>'}</i>`,click:async()=>{if(!t)try{await c()}catch(i){throw a.notice.show="Failed to initialize Cast API",e.onError?.(i),i}const n=window.cast.framework.CastContext.getInstance();if(o)s(a,o);else try{const e=await n.requestSession();s(a,e)}catch(i){throw a.notice.show="Error connecting to cast session",e.onError?.(i),i}}}),{name:"artplayerPluginChromecast",getCastState:()=>n,isCasting:()=>null!==o})}"undefined"!==typeof window&&(window.artplayerPluginChromecast=e);export{e as default};
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "artplayer-plugin-chromecast",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"description": "Chromecast plugin for ArtPlayer",
|
||||
"author": "Harvey Zhao <laozhaochaguan@gmail.com>",
|
||||
"license": "MIT",
|
||||
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-danmuku-mask.js v1.0.0
|
||||
* artplayer-plugin-danmuku-mask.js v1.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,n,s){var a="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},o="function"==typeof a[n]&&a[n],l=o.i||{},i=o.cache||{},p="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(t,r){if(!i[t]){if(!e[t]){if(s[t])return s[t];var l="function"==typeof a[n]&&a[n];if(!r&&l)return l(t,!0);if(o)return o(t,!0);if(p&&"string"==typeof t)return p(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}f.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},f.cache={};var d=i[t]=new u.Module(t);e[t][0].call(d.exports,f,d,d.exports,a)}return i[t].exports;function f(e){var t=f.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=u(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 u(t)}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.require=p,this.exports={}},u.modules=e,u.cache=i,u.parent=o,u.distDir=void 0,u.publicUrl=void 0,u.devServer=void 0,u.i=l,u.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(u,"root",{get:function(){return a[n]}}),a[n]=u;for(var c=0;c<t.length;c++)u(t[c]);if(r){var d=u(r);"object"==typeof exports&&"u">typeof module?module.exports=d:"function"==typeof define&&define.amd&&define(function(){return d})}}({ecCzQ:[function(e,t,r,n){var s=e("@parcel/transformer-js/src/esmodule-helpers.js");s.defineInteropFlag(r),s.export(r,"default",()=>l);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;e<t.length;e+=4)t[e]>250&&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"),"u">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-coLine truncated
|
||||
!function(e,t){"object"===typeof exports&&"undefined"!==typeof module?module.exports=t():"function"==typeof define&&define.amd?(t.ArtplayerPluginDanmukuMask=t(),define(function(){return t.ArtplayerPluginDanmukuMask})):(e="undefined"!==typeof globalThis?globalThis:e||self).ArtplayerPluginDanmukuMask=t()}(this,function(){"use strict";function e(e,t){for(var n=0;n<t.length;n++){const r=t[n];if("string"!==typeof r&&!Array.isArray(r))for(const t in r)if("default"!==t&&!(t in e)){const n=Object.getOwnPropertyDescriptor(r,t);n&&Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}class t{constructor(e,t){this.backend=e,this.dataMover=t,this.data=new WeakMap,this.dataIdsCount=0}get(e){return this.data.has(e)||this.dataMover.moveData(this.backend,e),this.data.get(e)}set(e,t){this.dataIdsCount++,this.data.set(e,t)}has(e){return this.data.has(e)}delete(e){return this.dataIdsCount--,this.data.delete(e)}numDataIds(){return this.dataIdsCount}}class n{refCount(e){return r("refCount")}incRef(e){return r("incRef")}timerAvailable(){return!0}time(e){return r("time")}read(e){return r("read")}readSync(e){return r("readSync")}readToGPU(e,t){return r("readToGPU")}numDataIds(){return r("numDataIds")}disposeData(e,t){return r("disposeData")}write(e,t,n){return r("write")}move(e,t,n,a,s){return r("move")}createTensorFromGPUData(e,t,n){return r("createTensorFromGPUData")}memory(){return r("memory")}floatPrecision(){return r("floatPrecision")}epsilon(){return 32===this.floatPrecision()?1e-7:1e-4}dispose(){return r("dispose")}}function r(e){throw new Error(`'${e}' not yet implemented or not found in the registry. This kernel may not be supported by the tfjs backend you have chosen`)}function a(e,t,n){return Math.max(e,Math.min(t,n))}function s(e){return e%2===0?e:e+1}function o(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function i(e,t){if(!e)throw new Error("string"===typeof t?t:t())}function u(e,t,n=""){i(d(e,t),()=>n+` Shapes ${e} and ${t} must match`)}function l(e){i(null!=e,()=>"The input to the tensor constructor must be a non-null value.")}function c(e){if(0===e.length)return 1;let t=e[0];for(let n=1;n<e.length;n++)t*=e[n];return t}function d(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function p(e){return e%1===0}function h(e){const t=Math.ceil(Math.sqrt(e));return[t,Math.ceil(e/t)]}function f(e,t){return t<=e.length?e:e+" ".repeat(t-e.length)}function m(e,t=e=>0,n,r){return new Promise((a,s)=>{let o=0;const i=()=>{if(e())return void a();o++;const u=t(o);null!=n&&o>=n?s():null!=r?r(i,u):setTimeout(i,u)};i()})}function g(e,t){let n=1,r=-1;for(let s=0;s<e.length;++s)if(e[s]>=0)n*=e[s];else if(-1===e[s]){if(-1!==r)throw Error(`Shapes can only have 1 implicit size. Found -1 at dim ${r} and dim ${s}`);r=s}else if(e[s]<0)throw Error(`Shapes can not be < 0. Found ${e[s]} at dim ${s}`);if(-1===r){if(t>0&&t!==n)throw Error(`Size(${t}) must match the product of shape ${e}`);return e}if(0===n)throw Error(`Cannot infer the missing size in [${e}] when there are 0 elements`);if(t%n!==0)throw Error(`The implicit shape can't be a fractional number. Got ${t} / ${n}`);const a=e.slice();return a[r]=t/n,a}function y(e,t){const n=t.length;return i((e=null==e?t.map((e,t)=>t):[].concat(e)).every(e=>e>=-n&&e<n),()=>`All values in axis param must be in range [-${n}, ${n}) but got axis ${e}`),i(e.every(e=>p(e)),()=>`All values in axis param must be integers but got axis ${e}`),e.map(e=>e<0?n+e:e)}function b(e,t){const n=[],r=[],a=null!=t&&Array.isArray(t)&&0===t.length,s=null==t||a?null:y(t,e).sort();let o=0;for(let i=0;i<e.length;++i){if(null!=s){if(s[o]===i&&1!==e[i])throw new Error(`Can't squeeze axis ${i} since its dim '${e[i]}' is not 1`);(null==s[o]||s[o]>i)&&1===e[i]&&(n.push(e[i]),r.push(i)),s[o]<=i&&o++}1!==e[i]&&(n.push(e[i]),r.push(i))}return{newShape:n,keptDims:r}}function x(e,t){return v(e,t)}function v(e,t){let n=null;if(null==e||"float32"===e)n=new Float32Array(t);else if("int32"===e)n=new Int32Array(t);else if("bool"===e)n=new Uint8Array(t);else{if("string"!==e)throw new Error(`Unknown data type ${e}`);n=new Array(t)}return n}function w(e,t){return"complex64"!==t&&(("float32"!==t||"complex64"===e)&&(("int32"!==t||"float32"===e||"complex64"===e)&&("bool"!==t||"bool"!==e)))}function k(e){if("float32"===e||"int32"===e)return 4;if("complex64"===e)return 8;if("bool"===e)return 1;throw new Error(`Unknown dtype ${e}`)}function I(e){return"string"===typeof e||e instanceof String}function N(e){return Array.isArray(e)?N(e[0]):e instanceof Float32Array?"float32":e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray?"int32":"number"===typeof e?"float32":I(e)?"string":function(e){return"boolean"===typeof e}(e)?"bool":"float32"}function S(e){return!!(e&&e.constructor&&e.call&&e.apply)}function T(e,t){for(let n=t;n<e;++n)if(e%n===0)return nLine truncated
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-danmuku-mask.js v1.0.0
|
||||
* artplayer-plugin-danmuku-mask.js v1.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,n,a){var s="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},o="function"==typeof s[n]&&s[n],i=o.i||{},c=o.cache||{},u="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function l(t,r){if(!c[t]){if(!e[t]){if(a[t])return a[t];var i="function"==typeof s[n]&&s[n];if(!r&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var p=Error("Cannot find module '"+t+"'");throw p.code="MODULE_NOT_FOUND",p}d.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},d.cache={};var f=c[t]=new l.Module(t);e[t][0].call(f.exports,d,f,f.exports,s)}return c[t].exports;function d(e){var t=d.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],s=l(n);"*"===t?Object.keys(s).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return s[e]}})}):"*"===a?Object.defineProperty(r,t,{enumerable:!0,value:s}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===a?s.__esModule?s.default:s:s[a]}})}),r}return l(t)}}l.isParcelRequire=!0,l.Module=function(e){this.id=e,this.bundle=l,this.require=u,this.exports={}},l.modules=e,l.cache=c,l.parent=o,l.distDir=void 0,l.publicUrl=void 0,l.devServer=void 0,l.i=i,l.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(l,"root",{get:function(){return s[n]}}),s[n]=l;for(var p=0;p<t.length;p++)l(t[p]);if(r){var f=l(r);"object"==typeof exports&&"u">typeof module?module.exports=f:"function"==typeof define&&define.amd&&define(function(){return f})}}({"1FGEJ":[function(e,t,r,n){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(r),a.export(r,"default",function(){return u});var s=e("@swc/helpers/cjs/_async_to_generator.cjs"),o=e("@swc/helpers/cjs/_ts_generator.cjs"),i=e("@tensorflow-models/body-segmentation"),c=e("@tensorflow/tfjs-core");function u(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t){var r=t.template,n=r.$video,a=r.$danmuku,u=null,l=null,p=null,f=null,d=!1,h={solutionPath:e.solutionPath||"https://cdn.jsdelivr.net/npm/@mediapipe/selfie_segmentation",modelSelection:e.modelSelection||1,smoothSegmentation:void 0===e.smoothSegmentation||e.smoothSegmentation,minDetectionConfidence:e.minDetectionConfidence||.5,minTrackingConfidence:e.minTrackingConfidence||.5,selfieMode:e.selfieMode||!1,drawContour:e.drawContour||!1,foregroundThreshold:e.foregroundThreshold||.5,opacity:e.opacity||1,maskBlurAmount:e.maskBlurAmount||3};function m(){return(0,s._)(function(){return(0,o._)(this,function(e){switch(e.label){case 0:if(d)return[3,2];return[4,(0,s._)(function(){var e,t;return(0,o._)(this,function(r){switch(r.label){case 0:return[4,(0,s._)(function(){return(0,o._)(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,4]),[4,c.setBackend("webgl")];case 1:case 3:return e.sent(),[3,4];case 2:return console.warn("WebGL backend not available, falling back to CPU",e.sent().message),[4,c.setBackend("cpu")];case 4:return[2]}})})()];case 1:r.sent(),e=i.SupportedModels.MediaPipeSelfieSegmentation,t={runtime:"mediapipe",modelType:"general",solutionPath:h.solutionPath,modelSelection:h.modelSelection,smoothSegmentation:h.smoothSegmentation,minDetectionConfidence:h.minDetectionConfidence,minTrackingConfidence:h.minTrackingConfidence,selfieMode:h.selfieMode},r.label=2;case 2:return r.trys.push([2,4,,5]),[4,i.createSegmenter(e,t)];case 3:return u=r.sent(),d=!0,[3,5];case 4:return console.error("Error initializing segmenter:",r.sent()),d=!1,[3,5];case 5:return[2]}})})()];case 1:e.sent(),e.label=2;case 2:return l||(p=(l=document.createElement("canvas")).getContext("2d")),Object.assign(a.style,{maskMode:"alpha",maskSize:"contain",maskRepeat:"no-repeat",backgroundSize:"contain",backgroundRepeat:"no-repeat"}),!function e(){return(0,s._)(function(){var t,r,s,c,m;return(0,o._)(this,function(o){switch(o.label){case 0:if(!d||n.paused||n.ended)return f=requestAnimationFrame(e),[2];o.label=1;case 1:return o.trys.push([1,5,,6]),l.width=n.videoWidth,l.height=n.videoHeight,[4,u.segmentPeople(n)];case 2:if(!(t=o.sent())||0===t.length)return f=requestAnimationFrame(e),[2];return r={r:255,g:255,b:255,a:255},s={r:0,g:0,b:0,a:255},[4,i.toBinaryMask(t,r,s,h.drawContour,h.foregroundThreshold)];case 3:return c=o.sent(),[4,i.drawMask(l,n,c,h.opacity,h.maskBlurAmount)];case 4:return o.sent(),m=p.getImageData(0,0,l.width,l.height),p.putImageData(function(e){for(var t=e.data,r=0;r<t.length;r+=4)t[r]>250&&t[r+1]>250&&t[r+2]>250&&(t[r+3]=0);return e}(m),0,0),a.style.maskImage="url(".concat(l.toDataURL(),")"),[3,6];case 5:return console.error("Error in segmentBody:",o.sent()),[3,6];case 6:return f=requestAnimationFrame(e),[2]}})})()}(),[2]}})})()}function g(){a.style.maskImage="none",f&&(cancelAnimationFrame(f),f=null)}return t.on("readyLine truncated
|
||||
!function(e,t){"object"===typeof exports&&"undefined"!==typeof module?module.exports=t():"function"==typeof define&&define.amd?(t.ArtplayerPluginDanmukuMask=t(),define(function(){return t.ArtplayerPluginDanmukuMask})):(e="undefined"!==typeof globalThis?globalThis:e||self).ArtplayerPluginDanmukuMask=t()}(this,function(){"use strict";var e=(e,t,n)=>new Promise((r,a)=>{var s=e=>{try{i(n.next(e))}catch(t){a(t)}},o=e=>{try{i(n.throw(e))}catch(t){a(t)}},i=e=>e.done?r(e.value):Promise.resolve(e.value).then(s,o);i((n=n.apply(e,t)).next())});function t(e,t){for(var n=0;n<t.length;n++){const r=t[n];if("string"!==typeof r&&!Array.isArray(r))for(const t in r)if("default"!==t&&!(t in e)){const n=Object.getOwnPropertyDescriptor(r,t);n&&Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}class n{constructor(e,t){this.backend=e,this.dataMover=t,this.data=new WeakMap,this.dataIdsCount=0}get(e){return this.data.has(e)||this.dataMover.moveData(this.backend,e),this.data.get(e)}set(e,t){this.dataIdsCount++,this.data.set(e,t)}has(e){return this.data.has(e)}delete(e){return this.dataIdsCount--,this.data.delete(e)}numDataIds(){return this.dataIdsCount}}class r{refCount(e){return a("refCount")}incRef(e){return a("incRef")}timerAvailable(){return!0}time(e){return a("time")}read(e){return a("read")}readSync(e){return a("readSync")}readToGPU(e,t){return a("readToGPU")}numDataIds(){return a("numDataIds")}disposeData(e,t){return a("disposeData")}write(e,t,n){return a("write")}move(e,t,n,r,s){return a("move")}createTensorFromGPUData(e,t,n){return a("createTensorFromGPUData")}memory(){return a("memory")}floatPrecision(){return a("floatPrecision")}epsilon(){return 32===this.floatPrecision()?1e-7:1e-4}dispose(){return a("dispose")}}function a(e){throw new Error(`'${e}' not yet implemented or not found in the registry. This kernel may not be supported by the tfjs backend you have chosen`)}function s(e,t,n){return Math.max(e,Math.min(t,n))}function o(e){return e%2===0?e:e+1}function i(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function u(e,t){if(!e)throw new Error("string"===typeof t?t:t())}function l(e,t,n=""){u(p(e,t),()=>n+` Shapes ${e} and ${t} must match`)}function c(e){u(null!=e,()=>"The input to the tensor constructor must be a non-null value.")}function d(e){if(0===e.length)return 1;let t=e[0];for(let n=1;n<e.length;n++)t*=e[n];return t}function p(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function h(e){return e%1===0}function f(e){const t=Math.ceil(Math.sqrt(e));return[t,Math.ceil(e/t)]}function m(e,t){return t<=e.length?e:e+" ".repeat(t-e.length)}function g(e,t=e=>0,n,r){return new Promise((a,s)=>{let o=0;const i=()=>{if(e())return void a();o++;const u=t(o);null!=n&&o>=n?s():null!=r?r(i,u):setTimeout(i,u)};i()})}function y(e,t){let n=1,r=-1;for(let s=0;s<e.length;++s)if(e[s]>=0)n*=e[s];else if(-1===e[s]){if(-1!==r)throw Error(`Shapes can only have 1 implicit size. Found -1 at dim ${r} and dim ${s}`);r=s}else if(e[s]<0)throw Error(`Shapes can not be < 0. Found ${e[s]} at dim ${s}`);if(-1===r){if(t>0&&t!==n)throw Error(`Size(${t}) must match the product of shape ${e}`);return e}if(0===n)throw Error(`Cannot infer the missing size in [${e}] when there are 0 elements`);if(t%n!==0)throw Error(`The implicit shape can't be a fractional number. Got ${t} / ${n}`);const a=e.slice();return a[r]=t/n,a}function b(e,t){const n=t.length;return u((e=null==e?t.map((e,t)=>t):[].concat(e)).every(e=>e>=-n&&e<n),()=>`All values in axis param must be in range [-${n}, ${n}) but got axis ${e}`),u(e.every(e=>h(e)),()=>`All values in axis param must be integers but got axis ${e}`),e.map(e=>e<0?n+e:e)}function x(e,t){const n=[],r=[],a=null!=t&&Array.isArray(t)&&0===t.length,s=null==t||a?null:b(t,e).sort();let o=0;for(let i=0;i<e.length;++i){if(null!=s){if(s[o]===i&&1!==e[i])throw new Error(`Can't squeeze axis ${i} since its dim '${e[i]}' is not 1`);(null==s[o]||s[o]>i)&&1===e[i]&&(n.push(e[i]),r.push(i)),s[o]<=i&&o++}1!==e[i]&&(n.push(e[i]),r.push(i))}return{newShape:n,keptDims:r}}function v(e,t){return w(e,t)}function w(e,t){let n=null;if(null==e||"float32"===e)n=new Float32Array(t);else if("int32"===e)n=new Int32Array(t);else if("bool"===e)n=new Uint8Array(t);else{if("string"!==e)throw new Error(`Unknown data type ${e}`);n=new Array(t)}return n}function k(e,t){return"complex64"!==t&&(("float32"!==t||"complex64"===e)&&(("int32"!==t||"float32"===e||"complex64"===e)&&("bool"!==t||"bool"!==e)))}function I(e){if("float32"===e||"int32"===e)return 4;if("complex64"===e)return 8;if("bool"===e)return 1;throw new Error(`Unknown dtype ${e}`)}function N(e){return"string"===typeof e||e instanceof String}function S(e){return Array.isArray(e)?S(e[0]):e instanceof Float32Array?"float32":e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray?"int32":"number"===tLine truncated
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-danmuku-mask.js v1.0.0
|
||||
* artplayer-plugin-danmuku-mask.js v1.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,n,s){var a="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},o="function"==typeof a[n]&&a[n],l=o.i||{},i=o.cache||{},u="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,r){if(!i[t]){if(!e[t]){if(s[t])return s[t];var l="function"==typeof a[n]&&a[n];if(!r&&l)return l(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}f.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},f.cache={};var d=i[t]=new p.Module(t);e[t][0].call(d.exports,f,d,d.exports,a)}return i[t].exports;function f(e){var t=f.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=p(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 p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=u,this.exports={}},p.modules=e,p.cache=i,p.parent=o,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=l,p.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(p,"root",{get:function(){return a[n]}}),a[n]=p;for(var c=0;c<t.length;c++)p(t[c]);if(r){var d=p(r);"object"==typeof exports&&"u">typeof module?module.exports=d:"function"==typeof define&&define.amd&&define(function(){return d})}}({"1AHlH":[function(e,t,r,n){var s=e("@parcel/transformer-js/src/esmodule-helpers.js");s.defineInteropFlag(r),s.export(r,"default",()=>l);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,u=null,p=!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),p=!0}catch(e){console.error("Error initializing segmenter:",e),p=!1}}async function h(){if(!p||r.paused||r.ended){u=requestAnimationFrame(h);return}try{l.width=r.videoWidth,l.height=r.videoHeight;let e=await s.segmentPeople(r);if(!e||0===e.length){u=requestAnimationFrame(h);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;e<t.length;e+=4)t[e]>250&&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)}u=requestAnimationFrame(h)}async function m(){p||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"}),h()}function g(){n.style.maskImage="none",u&&(cancelAnimationFrame(u),u=null)}return t.on("ready",m),t.on("destroy",g),{name:"artplayerPluginDanmukuMask",start:m,stop:g}}}e("@tensorflow/tfjs-backend-webgl"),e("@tensorflow/tfjs-backend-cpu"),"u">typeof window&&(window.artplayerPluginDanmukuMask=l)},{"@tensorflow-models/body-segmentation":"9d7iE","@tensorflow/tfjs-core":"hADTC","@tensorflow/tfjs-backend-webgl":"3qRAd","@tensorflow/tfjs-backend-cpu":"ilpJu","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],"9d7iE":[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",()=>eQ),a.export(r,"bodyPixMaskValueToRainbowColor",()=>_),a.export(r,"createSegmenter",()=>eP),a.export(r,"drawBokehEffect",()=>eZ),a.export(r,"drawMask",()=>eJ),a.export(r,"drawPixelatedMask",()=>eY),a.export(r,"toBinaryMask",()=>eH),a.export(r,"toColoredMask",()=>eK);var o=e("@tensorflow/tfjs-Line truncated
|
||||
function e(e,t){for(var n=0;n<t.length;n++){const r=t[n];if("string"!==typeof r&&!Array.isArray(r))for(const t in r)if("default"!==t&&!(t in e)){const n=Object.getOwnPropertyDescriptor(r,t);n&&Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}class t{constructor(e,t){this.backend=e,this.dataMover=t,this.data=/* @__PURE__ */new WeakMap,this.dataIdsCount=0}get(e){return this.data.has(e)||this.dataMover.moveData(this.backend,e),this.data.get(e)}set(e,t){this.dataIdsCount++,this.data.set(e,t)}has(e){return this.data.has(e)}delete(e){return this.dataIdsCount--,this.data.delete(e)}numDataIds(){return this.dataIdsCount}}class n{refCount(e){return r("refCount")}incRef(e){return r("incRef")}timerAvailable(){return!0}time(e){return r("time")}read(e){return r("read")}readSync(e){return r("readSync")}readToGPU(e,t){return r("readToGPU")}numDataIds(){return r("numDataIds")}disposeData(e,t){return r("disposeData")}write(e,t,n){return r("write")}move(e,t,n,a,s){return r("move")}createTensorFromGPUData(e,t,n){return r("createTensorFromGPUData")}memory(){return r("memory")}floatPrecision(){return r("floatPrecision")}epsilon(){return 32===this.floatPrecision()?1e-7:1e-4}dispose(){return r("dispose")}}function r(e){throw new Error(`'${e}' not yet implemented or not found in the registry. This kernel may not be supported by the tfjs backend you have chosen`)}function a(e,t,n){return Math.max(e,Math.min(t,n))}function s(e){return e%2===0?e:e+1}function o(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function i(e,t){if(!e)throw new Error("string"===typeof t?t:t())}function u(e,t,n=""){i(d(e,t),()=>n+` Shapes ${e} and ${t} must match`)}function l(e){i(null!=e,()=>"The input to the tensor constructor must be a non-null value.")}function c(e){if(0===e.length)return 1;let t=e[0];for(let n=1;n<e.length;n++)t*=e[n];return t}function d(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function p(e){return e%1===0}function h(e){const t=Math.ceil(Math.sqrt(e));return[t,Math.ceil(e/t)]}function f(e,t){return t<=e.length?e:e+" ".repeat(t-e.length)}function m(e,t=e=>0,n,r){return new Promise((a,s)=>{let o=0;const i=()=>{if(e())return void a();o++;const u=t(o);null!=n&&o>=n?s():null!=r?r(i,u):setTimeout(i,u)};i()})}function g(e,t){let n=1,r=-1;for(let s=0;s<e.length;++s)if(e[s]>=0)n*=e[s];else if(-1===e[s]){if(-1!==r)throw Error(`Shapes can only have 1 implicit size. Found -1 at dim ${r} and dim ${s}`);r=s}else if(e[s]<0)throw Error(`Shapes can not be < 0. Found ${e[s]} at dim ${s}`);if(-1===r){if(t>0&&t!==n)throw Error(`Size(${t}) must match the product of shape ${e}`);return e}if(0===n)throw Error(`Cannot infer the missing size in [${e}] when there are 0 elements`);if(t%n!==0)throw Error(`The implicit shape can't be a fractional number. Got ${t} / ${n}`);const a=e.slice();return a[r]=t/n,a}function y(e,t){const n=t.length;return i((e=null==e?t.map((e,t)=>t):[].concat(e)).every(e=>e>=-n&&e<n),()=>`All values in axis param must be in range [-${n}, ${n}) but got axis ${e}`),i(e.every(e=>p(e)),()=>`All values in axis param must be integers but got axis ${e}`),e.map(e=>e<0?n+e:e)}function b(e,t){const n=[],r=[],a=null!=t&&Array.isArray(t)&&0===t.length,s=null==t||a?null:y(t,e).sort();let o=0;for(let i=0;i<e.length;++i){if(null!=s){if(s[o]===i&&1!==e[i])throw new Error(`Can't squeeze axis ${i} since its dim '${e[i]}' is not 1`);(null==s[o]||s[o]>i)&&1===e[i]&&(n.push(e[i]),r.push(i)),s[o]<=i&&o++}1!==e[i]&&(n.push(e[i]),r.push(i))}return{newShape:n,keptDims:r}}function x(e,t){return v(e,t)}function v(e,t){let n=null;if(null==e||"float32"===e)n=new Float32Array(t);else if("int32"===e)n=new Int32Array(t);else if("bool"===e)n=new Uint8Array(t);else{if("string"!==e)throw new Error(`Unknown data type ${e}`);n=new Array(t)}return n}function w(e,t){return"complex64"!==t&&(("float32"!==t||"complex64"===e)&&(("int32"!==t||"float32"===e||"complex64"===e)&&("bool"!==t||"bool"!==e)))}function k(e){if("float32"===e||"int32"===e)return 4;if("complex64"===e)return 8;if("bool"===e)return 1;throw new Error(`Unknown dtype ${e}`)}function I(e){return"string"===typeof e||e instanceof String}function N(e){return Array.isArray(e)?N(e[0]):e instanceof Float32Array?"float32":e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray?"int32":"number"===typeof e?"float32":I(e)?"string":function(e){return"boolean"===typeof e}(e)?"bool":"float32"}function S(e){return!!(e&&e.constructor&&e.call&&e.apply)}function T(e,t){for(let n=t;n<e;++n)if(e%n===0)return n;return e}function C(e){const t=e.length;if(t<2)return[];const n=new Array(t-1);n[t-2]=e[t-1];for(let r=t-3;r>=0;--r)n[r]=n[r+1]*e[r+1];return n}function $(e,t,n,r=!1){const a=new Array;if(1===t.length){const s=t[0]*(r?2:1);for(let t=0;t<s;t++)a[t]=n[e+t]}else{const s=t[0],o=t.slice(1),i=o.reduce((e,t)=>e*t)*(r?2:1);fLine truncated
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "artplayer-plugin-danmuku-mask",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "Danmuku mask plugin for ArtPlayer",
|
||||
"author": "Harvey Zhao <laozhaochaguan@gmail.com>",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-danmuku.js v5.2.0
|
||||
* artplayer-plugin-danmuku.js v5.2.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(t,e,i,a,n,o,s,r){var l="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},d="function"==typeof l[a]&&l[a],p=d.i||{},u=d.cache||{},h="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function m(e,i){if(!u[e]){if(!t[e]){if(n[e])return n[e];var o="function"==typeof l[a]&&l[a];if(!i&&o)return o(e,!0);if(d)return d(e,!0);if(h&&"string"==typeof e)return h(e);var s=Error("Cannot find module '"+e+"'");throw s.code="MODULE_NOT_FOUND",s}p.resolve=function(i){var a=t[e][1][i];return null!=a?a:i},p.cache={};var r=u[e]=new m.Module(e);t[e][0].call(r.exports,p,r,r.exports,l)}return u[e].exports;function p(t){var e=p.resolve(t);if(!1===e)return{};if(Array.isArray(e)){var i={__esModule:!0};return e.forEach(function(t){var e=t[0],a=t[1],n=t[2]||t[0],o=m(a);"*"===e?Object.keys(o).forEach(function(t){"default"===t||"__esModule"===t||Object.prototype.hasOwnProperty.call(i,t)||Object.defineProperty(i,t,{enumerable:!0,get:function(){return o[t]}})}):"*"===n?Object.defineProperty(i,e,{enumerable:!0,value:o}):Object.defineProperty(i,e,{enumerable:!0,get:function(){return"default"===n?o.__esModule?o.default:o:o[n]}})}),i}return m(e)}}m.isParcelRequire=!0,m.Module=function(t){this.id=t,this.bundle=m,this.require=h,this.exports={}},m.modules=t,m.cache=u,m.parent=d,m.distDir=void 0,m.publicUrl=void 0,m.devServer=void 0,m.i=p,m.register=function(e,i){t[e]=[function(t,e){e.exports=i},{}]},Object.defineProperty(m,"root",{get:function(){return l[a]}}),l[a]=m;for(var c=0;c<e.length;c++)m(e[c]);if(i){var f=m(i);"object"==typeof exports&&"u">typeof module?module.exports=f:"function"==typeof define&&define.amd&&define(function(){return f})}}({"666Ok":[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i),n.export(i,"default",()=>u);var o=t("./danmuku"),s=n.interopDefault(o),r=t("./heatmap"),l=n.interopDefault(r),d=t("./setting"),p=n.interopDefault(d);function u(t){return e=>{let i=new(0,s.default)(e,t),a=new(0,p.default)(e,i);return i.option.heatmap&&(0,l.default)(e,i,i.option.heatmap),{name:"artplayerPluginDanmuku",emit:i.emit.bind(i),load:i.load.bind(i),config:i.config.bind(i),hide:i.hide.bind(i),show:i.show.bind(i),reset:i.reset.bind(i),mount:a.mount.bind(a),get option(){return i.option},get isHide(){return i.isHide},get isStop(){return i.isStop}}}}u.icons=p.default.icons,"u">typeof window&&(window.artplayerPluginDanmuku=u)},{"./danmuku":"g81Wu","./heatmap":"hjtgU","./setting":"ho690","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],g81Wu:[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i);var o=t("bundle-text:./worker"),s=n.interopDefault(o),r=t("./bilibili");class l{constructor(t,e){const{constructor:i,template:a}=t;this.utils=i.utils,this.validator=i.validator,this.$danmuku=a.$danmuku,this.$player=a.$player,this.art=t,this.queue=[],this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.index=0,this.option=l.option,this.states={wait:[],ready:[],emit:[],stop:[]},this.config(e,!0);const n=new Blob([s.default.replace("export{e as default};","")],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(n)),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.resize=this.resize.bind(this),this.destroy=this.destroy.bind(this),t.on("video:play",this.start),t.on("video:playing",this.start),t.on("video:pause",this.stop),t.on("video:waiting",this.stop),t.on("destroy",this.destroy),t.on("resize",this.resize),this.load()}static get option(){return{danmuku:[],speed:5,margin:[10,"25%"],opacity:1,color:"#FFFFFF",mode:0,modes:[0,1,2],fontSize:25,antiOverlap:!0,synchronousPlayback:!1,mount:void 0,heatmap:!1,width:512,points:[],filter:()=>!0,beforeEmit:()=>!0,beforeVisible:()=>!0,visible:!0,emitter:!0,maxLength:200,lockTime:5,theme:"dark",OPACITY:{},FONT_SIZE:{},MARGIN:{},SPEED:{},COLOR:[]}}static get scheme(){return{danmuku:"array|function|string",speed:"number",margin:"array",opacity:"number",color:"string",mode:"number",modes:"array",fontSize:"number|string",antiOverlap:"boolean",synchronousPlayback:"boolean",mount:"?htmldivelement|string",heatmap:"object|boolean",width:"number",points:"array",filter:"function",beforeEmit:"function",beforeVisible:"function",visible:"boolean",emitter:"boolean",maxLength:"number",lockTime:"number",theme:"string",OPACITY:"object",FONT_SIZE:"object",MARGIN:"object",SPEED:"object",COLOR:"array"}}static get cssText(){return` user-select: none; position: absolute; white-space: pre; pointer-events: none; perspective: 500px; display: inline-block; will-change: transform; font-weight: normal; line-height: 1.125; visibility: hidden; font-family: SimHei, "Microsoft JhengHei", Arial, Helvetica, sans-serif; text-shadow: rgb(0, 0, 0) 1px 0px 1px, rgb(0, 0, 0) 0px 1px 1px, rgb(0, 0, 0) 0px -1px 1px, rgb(0, 0, 0) -1px 0px 1px; `}get isRotate(){return this.art.pLine truncated
|
||||
!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.ArtplayerPluginDanmuku=e(),define(function(){return t.ArtplayerPluginDanmuku})):(t="undefined"!==typeof globalThis?globalThis:t||self).ArtplayerPluginDanmuku=e()}(this,function(){"use strict";function t(t){switch(t){case 1:case 2:case 3:default:return 0;case 4:return 2;case 5:return 1}}function e(e){if("string"!==typeof e)return[];const i=e.matchAll(/<d[^>]*?p="(?<p>[^"]+)"[^>]*>(?<text>.*?)<\/d>/gs);return Array.from(i).map(e=>{const i=e.groups.p.split(",");if(i.length>=8){return{text:e.groups.text.trim().replaceAll(""",'"').replaceAll("'","'").replaceAll("<","<").replaceAll(">",">").replaceAll("&","&"),time:Number(i[0]),mode:t(Number(i[1])),fontSize:Number(i[2]),color:`#${Number(i[3]).toString(16)}`,timestamp:Number(i[4]),pool:Number(i[5]),userID:i[6],rowID:Number(i[7])}}return null}).filter(Boolean)}function i({data:t}){const{xml:i,id:a}=t;if(!a||!i)return;const n=e(i);globalThis.postMessage({danmus:n,id:a})}function a(){const a=`\n ${t.toString()}\n ${e.toString()}\n onmessage = ${i.toString()}\n `,n=new Blob([a],{type:"application/javascript"});return new Worker(URL.createObjectURL(n))}const n='/*!\n * artplayer-plugin-danmuku.js v5.2.1\n * Github: https://github.com/zhw2590582/ArtPlayer\n * (c) 2017-2026 Harvey Zhao\n * Released under the MIT License.\n */\nfunction t({target:t,visibles:e,clientWidth:i,clientHeight:h,marginBottom:n,marginTop:o,antiOverlap:s}){const r=h-n,p=e.filter(e=>e.mode===t.mode&&e.top<=r).sort((t,e)=>t.top-e.top);if(0===p.length)return 2===t.mode?r-t.height:o;if(p.unshift({type:"top",top:0,left:0,right:0,height:o,width:i,speed:0,distance:i}),p.push({type:"bottom",top:r,left:0,right:0,height:n,width:i,speed:0,distance:i}),2===t.mode)for(let g=p.length-2;g>=0;g-=1){const e=p[g],i=p[g+1],h=e.top+e.height;if(i.top-h>=t.height)return i.top-t.height}else for(let g=1;g<p.length;g+=1){const e=p[g],i=p[g-1],h=i.top+i.height;if(e.top-h>=t.height)return h}const a=[];for(let g=1;g<p.length-1;g+=1){const t=p[g];if(a.length){const e=a[a.length-1];e[0].top===t.top?e.push(t):a.push([t])}else a.push([t])}if(!s){switch(t.mode){case 0:a.sort((t,e)=>{const i=Math.min(...e.map(t=>t.right)),h=Math.min(...t.map(t=>t.right));return i*e.length-h*t.length});break;case 1:case 2:a.sort((t,e)=>{const i=Math.max(...e.map(t=>t.width));return Math.max(...t.map(t=>t.width))*t.length-i*e.length})}return a[0][0].top}switch(t.mode){case 0:{const e=a.find(e=>e.every(e=>{if(i<e.distance)return!1;if(t.speed<e.speed)return!0;return e.right/(t.speed-e.speed)>e.time}));return e&&e[0]?e[0].top:void 0}case 1:case 2:return}}onmessage=e=>{const{data:i}=e;if(!i.id||!i.type)return;const h=(0,{getDanmuTop:t}[i.type])(i);globalThis.postMessage({result:h,id:i.id})};\n',s="undefined"!==typeof self&&self.Blob&&new Blob(["URL.revokeObjectURL(import.meta.url);",n],{type:"text/javascript;charset=utf-8"});function o(t){let e;try{if(e=s&&(self.URL||self.webkitURL).createObjectURL(s),!e)throw"";const i=new Worker(e,{type:"module",name:t?.name});return i.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),i}catch(i){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(n),{type:"module",name:t?.name})}}class r{constructor(t,e){const{constructor:i,template:a}=t;this.utils=i.utils,this.validator=i.validator,this.$danmuku=a.$danmuku,this.$player=a.$player,this.art=t,this.queue=[],this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.index=0,this.option=r.option,this.states={wait:[],ready:[],emit:[],stop:[]},this.config(e,!0),this.worker=new o,this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.resize=this.resize.bind(this),this.destroy=this.destroy.bind(this),t.on("video:play",this.start),t.on("video:playing",this.start),t.on("video:pause",this.stop),t.on("video:waiting",this.stop),t.on("destroy",this.destroy),t.on("resize",this.resize),this.load()}static get option(){return{danmuku:[],speed:5,margin:[10,"25%"],opacity:1,color:"#FFFFFF",mode:0,modes:[0,1,2],fontSize:25,antiOverlap:!0,synchronousPlayback:!1,mount:void 0,heatmap:!1,width:512,points:[],filter:()=>!0,beforeEmit:()=>!0,beforeVisible:()=>!0,visible:!0,emitter:!0,maxLength:200,lockTime:5,theme:"dark",OPACITY:{},FONT_SIZE:{},MARGIN:{},SPEED:{},COLOR:[]}}static get scheme(){return{danmuku:"array|function|string",speed:"number",margin:"array",opacity:"number",color:"string",mode:"number",modes:"array",fontSize:"number|string",antiOverlap:"boolean",synchronousPlayback:"boolean",mount:"?htmldivelement|string",heatmap:"object|boolean",width:"number",points:"array",filter:"function",beforeEmit:"function",beforeVisible:"function",visible:"boolean",emitter:"boolean",maxLength:"number",lockTime:"number",theme:"string",OPACITY:"object",FONT_SIZE:"object",MARGIN:"object",SPEED:"object",COLOR:"array"}}static get cssLine truncated
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-danmuku.js v5.2.0
|
||||
* artplayer-plugin-danmuku.js v5.2.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,a,i,r,o,s){var l="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},u="function"==typeof l[a]&&l[a],d=u.i||{},c=u.cache||{},p="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,n){if(!c[t]){if(!e[t]){if(i[t])return i[t];var r="function"==typeof l[a]&&l[a];if(!n&&r)return r(t,!0);if(u)return u(t,!0);if(p&&"string"==typeof t)return p(t);var o=Error("Cannot find module '"+t+"'");throw o.code="MODULE_NOT_FOUND",o}d.resolve=function(n){var a=e[t][1][n];return null!=a?a:n},d.cache={};var s=c[t]=new f.Module(t);e[t][0].call(s.exports,d,s,s.exports,l)}return c[t].exports;function d(e){var t=d.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var n={__esModule:!0};return t.forEach(function(e){var t=e[0],a=e[1],i=e[2]||e[0],r=f(a);"*"===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 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=c,f.parent=u,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=d,f.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(f,"root",{get:function(){return l[a]}}),l[a]=f;for(var h=0;h<t.length;h++)f(t[h]);if(n){var m=f(n);"object"==typeof exports&&"u">typeof module?module.exports=m:"function"==typeof define&&define.amd&&define(function(){return m})}}({l3CkF:[function(e,t,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"default",function(){return c});var r=e("./danmuku"),o=i.interopDefault(r),s=e("./heatmap"),l=i.interopDefault(s),u=e("./setting"),d=i.interopDefault(u);function c(e){return function(t){var n=new(0,o.default)(t,e),a=new(0,d.default)(t,n);return n.option.heatmap&&(0,l.default)(t,n,n.option.heatmap),{name:"artplayerPluginDanmuku",emit:n.emit.bind(n),load:n.load.bind(n),config:n.config.bind(n),hide:n.hide.bind(n),show:n.show.bind(n),reset:n.reset.bind(n),mount:a.mount.bind(a),get option(){return n.option},get isHide(){return n.isHide},get isStop(){return n.isStop}}}}c.icons=d.default.icons,"u">typeof window&&(window.artplayerPluginDanmuku=c)},{"./danmuku":"u1ZRC","./heatmap":"hLPK6","./setting":"jpEpW","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],u1ZRC:[function(e,t,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"default",function(){return h});var r=e("@swc/helpers/cjs/_async_to_generator.cjs"),o=e("@swc/helpers/cjs/_class_call_check.cjs"),s=e("@swc/helpers/cjs/_create_class.cjs"),l=e("@swc/helpers/cjs/_object_spread.cjs"),u=e("@swc/helpers/cjs/_object_spread_props.cjs"),d=e("@swc/helpers/cjs/_ts_generator.cjs"),c=e("bundle-text:./worker"),p=i.interopDefault(c),f=e("./bilibili"),h=function(){"use strict";function e(t,n){(0,o._)(this,e);var a=t.constructor,i=t.template;this.utils=a.utils,this.validator=a.validator,this.$danmuku=i.$danmuku,this.$player=i.$player,this.art=t,this.queue=[],this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.index=0,this.option=e.option,this.states={wait:[],ready:[],emit:[],stop:[]},this.config(n,!0);var r=new Blob([p.default.replace("export{e as default};","")],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(r)),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.resize=this.resize.bind(this),this.destroy=this.destroy.bind(this),t.on("video:play",this.start),t.on("video:playing",this.start),t.on("video:pause",this.stop),t.on("video:waiting",this.stop),t.on("destroy",this.destroy),t.on("resize",this.resize),this.load()}return(0,s._)(e,[{key:"isRotate",get:function(){var e,t;return null==(t=this.art.plugins)||null==(e=t.autoOrientation)?void 0:e.state}},{key:"marginTop",get:function(){var t=this.utils.clamp,n=this.option.margin[0],a=this.$player.clientHeight;return"number"==typeof n?t(n,0,a):"string"==typeof n&&n.endsWith("%")?t(a*(Number.parseFloat(n)/100),0,a):e.option.margin[0]}},{key:"marginBottom",get:function(){var t=this.utils.clamp,n=this.option.margin[1],a=this.$player.clientHeight;return"number"==typeof n?t(n,0,a):"string"==typeof n&&n.endsWith("%")?t(a*(Number.parseFloat(n)/100),0,a):e.option.margin[1]}},{key:"fontSize",get:function(){var t=this.utils.clamp,n=this.$player.clientHeight,a=this.option.fontSize;return"number"==typeof a?Math.round(t(a,12,n)):"string"==typeof a&&a.endsWith("%")?Math.round(t(n*(Number.parseFloat(a)/100),12,n)):e.option.fontSize}},{key:"$ref",get:function(){var t=this.$refs.pop()||document.createElement("div");return t.style.cssText=e.cssText,t.dataset.mode="",t.dataset.id="",t.clLine truncated
|
||||
!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.ArtplayerPluginDanmuku=e(),define(function(){return t.ArtplayerPluginDanmuku})):(t="undefined"!==typeof globalThis?globalThis:t||self).ArtplayerPluginDanmuku=e()}(this,function(){"use strict";var t=Object.defineProperty,e=Object.defineProperties,i=Object.getOwnPropertyDescriptors,a=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,o=Math.pow,r=(e,i,a)=>i in e?t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[i]=a,l=(t,e)=>{for(var i in e||(e={}))n.call(e,i)&&r(t,i,e[i]);if(a)for(var i of a(e))s.call(e,i)&&r(t,i,e[i]);return t},d=(t,a)=>e(t,i(a)),p=(t,e,i)=>new Promise((a,n)=>{var s=t=>{try{r(i.next(t))}catch(e){n(e)}},o=t=>{try{r(i.throw(t))}catch(e){n(e)}},r=t=>t.done?a(t.value):Promise.resolve(t.value).then(s,o);r((i=i.apply(t,e)).next())});function h(t){switch(t){case 1:case 2:case 3:default:return 0;case 4:return 2;case 5:return 1}}function u(t){if("string"!==typeof t)return[];const e=new RegExp('<d[^>]*?p="(?<p>[^"]+)"[^>]*>(?<text>.*?)<\\/d>',"gs"),i=t.matchAll(e);return Array.from(i).map(t=>{const e=t.groups.p.split(",");if(e.length>=8){return{text:t.groups.text.trim().replaceAll(""",'"').replaceAll("'","'").replaceAll("<","<").replaceAll(">",">").replaceAll("&","&"),time:Number(e[0]),mode:h(Number(e[1])),fontSize:Number(e[2]),color:`#${Number(e[3]).toString(16)}`,timestamp:Number(e[4]),pool:Number(e[5]),userID:e[6],rowID:Number(e[7])}}return null}).filter(Boolean)}function c({data:t}){const{xml:e,id:i}=t;if(!i||!e)return;const a=u(e);globalThis.postMessage({danmus:a,id:i})}function m(){const t=`\n ${h.toString()}\n ${u.toString()}\n onmessage = ${c.toString()}\n `,e=new Blob([t],{type:"application/javascript"});return new Worker(URL.createObjectURL(e))}const f='/*!\n * artplayer-plugin-danmuku.js v5.2.1\n * Github: https://github.com/zhw2590582/ArtPlayer\n * (c) 2017-2026 Harvey Zhao\n * Released under the MIT License.\n */\nfunction t({target:t,visibles:e,clientWidth:i,clientHeight:h,marginBottom:n,marginTop:o,antiOverlap:s}){const r=h-n,p=e.filter(e=>e.mode===t.mode&&e.top<=r).sort((t,e)=>t.top-e.top);if(0===p.length)return 2===t.mode?r-t.height:o;if(p.unshift({type:"top",top:0,left:0,right:0,height:o,width:i,speed:0,distance:i}),p.push({type:"bottom",top:r,left:0,right:0,height:n,width:i,speed:0,distance:i}),2===t.mode)for(let g=p.length-2;g>=0;g-=1){const e=p[g],i=p[g+1],h=e.top+e.height;if(i.top-h>=t.height)return i.top-t.height}else for(let g=1;g<p.length;g+=1){const e=p[g],i=p[g-1],h=i.top+i.height;if(e.top-h>=t.height)return h}const a=[];for(let g=1;g<p.length-1;g+=1){const t=p[g];if(a.length){const e=a[a.length-1];e[0].top===t.top?e.push(t):a.push([t])}else a.push([t])}if(!s){switch(t.mode){case 0:a.sort((t,e)=>{const i=Math.min(...e.map(t=>t.right)),h=Math.min(...t.map(t=>t.right));return i*e.length-h*t.length});break;case 1:case 2:a.sort((t,e)=>{const i=Math.max(...e.map(t=>t.width));return Math.max(...t.map(t=>t.width))*t.length-i*e.length})}return a[0][0].top}switch(t.mode){case 0:{const e=a.find(e=>e.every(e=>{if(i<e.distance)return!1;if(t.speed<e.speed)return!0;return e.right/(t.speed-e.speed)>e.time}));return e&&e[0]?e[0].top:void 0}case 1:case 2:return}}onmessage=e=>{const{data:i}=e;if(!i.id||!i.type)return;const h=(0,{getDanmuTop:t}[i.type])(i);globalThis.postMessage({result:h,id:i.id})};\n',g="undefined"!==typeof self&&self.Blob&&new Blob(["URL.revokeObjectURL(import.meta.url);",f],{type:"text/javascript;charset=utf-8"});function y(t){let e;try{if(e=g&&(self.URL||self.webkitURL).createObjectURL(g),!e)throw"";const i=new Worker(e,{type:"module",name:null==t?void 0:t.name});return i.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),i}catch(i){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(f),{type:"module",name:null==t?void 0:t.name})}}class v{constructor(t,e){const{constructor:i,template:a}=t;this.utils=i.utils,this.validator=i.validator,this.$danmuku=a.$danmuku,this.$player=a.$player,this.art=t,this.queue=[],this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.index=0,this.option=v.option,this.states={wait:[],ready:[],emit:[],stop:[]},this.config(e,!0),this.worker=new y,this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.resize=this.resize.bind(this),this.destroy=this.destroy.bind(this),t.on("video:play",this.start),t.on("video:playing",this.start),t.on("video:pause",this.stop),t.on("video:waiting",this.stop),t.on("destroy",this.destroy),t.on("resize",this.resize),this.load()}static get option(){return{danmuku:[],speed:5,margin:[10,"25%"],opacity:1,color:"#FFFFFF",mode:0,modes:[0,1,2],fontSize:25,antiOverlap:!0,synchronousPlayback:!1,mount:void 0,heatmap:!1,width:512,points:[],filter:()=>!0,beforeEmit:()=>!0,beforeVisible:()=>!0,vLine truncated
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-danmuku.js v5.2.0
|
||||
* artplayer-plugin-danmuku.js v5.2.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,i,a,o,n,s,r){var l="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},d="function"==typeof l[a]&&l[a],p=d.i||{},u=d.cache||{},h="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function m(t,i){if(!u[t]){if(!e[t]){if(o[t])return o[t];var n="function"==typeof l[a]&&l[a];if(!i&&n)return n(t,!0);if(d)return d(t,!0);if(h&&"string"==typeof t)return h(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}p.resolve=function(i){var a=e[t][1][i];return null!=a?a:i},p.cache={};var r=u[t]=new m.Module(t);e[t][0].call(r.exports,p,r,r.exports,l)}return u[t].exports;function p(e){var t=p.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var i={__esModule:!0};return t.forEach(function(e){var t=e[0],a=e[1],o=e[2]||e[0],n=m(a);"*"===t?Object.keys(n).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(i,e)||Object.defineProperty(i,e,{enumerable:!0,get:function(){return n[e]}})}):"*"===o?Object.defineProperty(i,t,{enumerable:!0,value:n}):Object.defineProperty(i,t,{enumerable:!0,get:function(){return"default"===o?n.__esModule?n.default:n:n[o]}})}),i}return m(t)}}m.isParcelRequire=!0,m.Module=function(e){this.id=e,this.bundle=m,this.require=h,this.exports={}},m.modules=e,m.cache=u,m.parent=d,m.distDir=void 0,m.publicUrl=void 0,m.devServer=void 0,m.i=p,m.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(m,"root",{get:function(){return l[a]}}),l[a]=m;for(var c=0;c<t.length;c++)m(t[c]);if(i){var f=m(i);"object"==typeof exports&&"u">typeof module?module.exports=f:"function"==typeof define&&define.amd&&define(function(){return f})}}({"7ICE7":[function(e,t,i,a){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(i),o.export(i,"default",()=>u);var n=e("./danmuku"),s=o.interopDefault(n),r=e("./heatmap"),l=o.interopDefault(r),d=e("./setting"),p=o.interopDefault(d);function u(e){return t=>{let i=new(0,s.default)(t,e),a=new(0,p.default)(t,i);return i.option.heatmap&&(0,l.default)(t,i,i.option.heatmap),{name:"artplayerPluginDanmuku",emit:i.emit.bind(i),load:i.load.bind(i),config:i.config.bind(i),hide:i.hide.bind(i),show:i.show.bind(i),reset:i.reset.bind(i),mount:a.mount.bind(a),get option(){return i.option},get isHide(){return i.isHide},get isStop(){return i.isStop}}}}u.icons=p.default.icons,"u">typeof window&&(window.artplayerPluginDanmuku=u)},{"./danmuku":"9bpce","./heatmap":"9KNY2","./setting":"94xSe","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],"9bpce":[function(e,t,i,a){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(i);var n=e("bundle-text:./worker"),s=o.interopDefault(n),r=e("./bilibili");class l{constructor(e,t){let{constructor:i,template:a}=e;this.utils=i.utils,this.validator=i.validator,this.$danmuku=a.$danmuku,this.$player=a.$player,this.art=e,this.queue=[],this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.index=0,this.option=l.option,this.states={wait:[],ready:[],emit:[],stop:[]},this.config(t,!0);let o=new Blob([s.default.replace("export{e as default};","")],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(o)),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.resize=this.resize.bind(this),this.destroy=this.destroy.bind(this),e.on("video:play",this.start),e.on("video:playing",this.start),e.on("video:pause",this.stop),e.on("video:waiting",this.stop),e.on("destroy",this.destroy),e.on("resize",this.resize),this.load()}static get option(){return{danmuku:[],speed:5,margin:[10,"25%"],opacity:1,color:"#FFFFFF",mode:0,modes:[0,1,2],fontSize:25,antiOverlap:!0,synchronousPlayback:!1,mount:void 0,heatmap:!1,width:512,points:[],filter:()=>!0,beforeEmit:()=>!0,beforeVisible:()=>!0,visible:!0,emitter:!0,maxLength:200,lockTime:5,theme:"dark",OPACITY:{},FONT_SIZE:{},MARGIN:{},SPEED:{},COLOR:[]}}static get scheme(){return{danmuku:"array|function|string",speed:"number",margin:"array",opacity:"number",color:"string",mode:"number",modes:"array",fontSize:"number|string",antiOverlap:"boolean",synchronousPlayback:"boolean",mount:"?htmldivelement|string",heatmap:"object|boolean",width:"number",points:"array",filter:"function",beforeEmit:"function",beforeVisible:"function",visible:"boolean",emitter:"boolean",maxLength:"number",lockTime:"number",theme:"string",OPACITY:"object",FONT_SIZE:"object",MARGIN:"object",SPEED:"object",COLOR:"array"}}static get cssText(){return` user-select: none; position: absolute; white-space: pre; pointer-events: none; perspective: 500px; display: inline-block; will-change: transform; font-weight: normal; line-height: 1.125; visibility: hidden; font-family: SimHei, "Microsoft JhengHei", Arial, Helvetica, sans-serif; text-shadow: rgb(0, 0, 0) 1px 0px 1px, rgb(0, 0, 0) 0px 1px 1px, rgb(0, 0, 0) 0px -1px 1px, rgb(0, 0, 0) -1px 0px 1px; `}get isRotate(){return this.art.pluLine truncated
|
||||
function t(t){switch(t){case 1:case 2:case 3:default:return 0;case 4:return 2;case 5:return 1}}function e(e){if("string"!==typeof e)return[];const i=e.matchAll(/<d[^>]*?p="(?<p>[^"]+)"[^>]*>(?<text>.*?)<\/d>/gs);return Array.from(i).map(e=>{const i=e.groups.p.split(",");if(i.length>=8){return{text:e.groups.text.trim().replaceAll(""",'"').replaceAll("'","'").replaceAll("<","<").replaceAll(">",">").replaceAll("&","&"),time:Number(i[0]),mode:t(Number(i[1])),fontSize:Number(i[2]),color:`#${Number(i[3]).toString(16)}`,timestamp:Number(i[4]),pool:Number(i[5]),userID:i[6],rowID:Number(i[7])}}return null}).filter(Boolean)}function i({data:t}){const{xml:i,id:a}=t;if(!a||!i)return;const n=e(i);globalThis.postMessage({danmus:n,id:a})}function a(){const a=`\n ${t.toString()}\n ${e.toString()}\n onmessage = ${i.toString()}\n `,n=new Blob([a],{type:"application/javascript"});return new Worker(URL.createObjectURL(n))}const n='/*!\n * artplayer-plugin-danmuku.js v5.2.1\n * Github: https://github.com/zhw2590582/ArtPlayer\n * (c) 2017-2026 Harvey Zhao\n * Released under the MIT License.\n */\nfunction t({target:t,visibles:e,clientWidth:i,clientHeight:h,marginBottom:n,marginTop:o,antiOverlap:s}){const r=h-n,p=e.filter(e=>e.mode===t.mode&&e.top<=r).sort((t,e)=>t.top-e.top);if(0===p.length)return 2===t.mode?r-t.height:o;if(p.unshift({type:"top",top:0,left:0,right:0,height:o,width:i,speed:0,distance:i}),p.push({type:"bottom",top:r,left:0,right:0,height:n,width:i,speed:0,distance:i}),2===t.mode)for(let g=p.length-2;g>=0;g-=1){const e=p[g],i=p[g+1],h=e.top+e.height;if(i.top-h>=t.height)return i.top-t.height}else for(let g=1;g<p.length;g+=1){const e=p[g],i=p[g-1],h=i.top+i.height;if(e.top-h>=t.height)return h}const a=[];for(let g=1;g<p.length-1;g+=1){const t=p[g];if(a.length){const e=a[a.length-1];e[0].top===t.top?e.push(t):a.push([t])}else a.push([t])}if(!s){switch(t.mode){case 0:a.sort((t,e)=>{const i=Math.min(...e.map(t=>t.right)),h=Math.min(...t.map(t=>t.right));return i*e.length-h*t.length});break;case 1:case 2:a.sort((t,e)=>{const i=Math.max(...e.map(t=>t.width));return Math.max(...t.map(t=>t.width))*t.length-i*e.length})}return a[0][0].top}switch(t.mode){case 0:{const e=a.find(e=>e.every(e=>{if(i<e.distance)return!1;if(t.speed<e.speed)return!0;return e.right/(t.speed-e.speed)>e.time}));return e&&e[0]?e[0].top:void 0}case 1:case 2:return}}onmessage=e=>{const{data:i}=e;if(!i.id||!i.type)return;const h=(0,{getDanmuTop:t}[i.type])(i);globalThis.postMessage({result:h,id:i.id})};\n',s="undefined"!==typeof self&&self.Blob&&new Blob(["URL.revokeObjectURL(import.meta.url);",n],{type:"text/javascript;charset=utf-8"});function o(t){let e;try{if(e=s&&(self.URL||self.webkitURL).createObjectURL(s),!e)throw"";const i=new Worker(e,{type:"module",name:t?.name});return i.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),i}catch(i){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(n),{type:"module",name:t?.name})}}class r{constructor(t,e){const{constructor:i,template:a}=t;this.utils=i.utils,this.validator=i.validator,this.$danmuku=a.$danmuku,this.$player=a.$player,this.art=t,this.queue=[],this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.index=0,this.option=r.option,this.states={wait:[],ready:[],emit:[],stop:[]},this.config(e,!0),this.worker=new o,this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.resize=this.resize.bind(this),this.destroy=this.destroy.bind(this),t.on("video:play",this.start),t.on("video:playing",this.start),t.on("video:pause",this.stop),t.on("video:waiting",this.stop),t.on("destroy",this.destroy),t.on("resize",this.resize),this.load()}static get option(){return{danmuku:[],speed:5,margin:[10,"25%"],opacity:1,color:"#FFFFFF",mode:0,modes:[0,1,2],fontSize:25,antiOverlap:!0,synchronousPlayback:!1,mount:void 0,heatmap:!1,width:512,points:[],filter:()=>!0,beforeEmit:()=>!0,beforeVisible:()=>!0,visible:!0,emitter:!0,maxLength:200,lockTime:5,theme:"dark",OPACITY:{},FONT_SIZE:{},MARGIN:{},SPEED:{},COLOR:[]}}static get scheme(){return{danmuku:"array|function|string",speed:"number",margin:"array",opacity:"number",color:"string",mode:"number",modes:"array",fontSize:"number|string",antiOverlap:"boolean",synchronousPlayback:"boolean",mount:"?htmldivelement|string",heatmap:"object|boolean",width:"number",points:"array",filter:"function",beforeEmit:"function",beforeVisible:"function",visible:"boolean",emitter:"boolean",maxLength:"number",lockTime:"number",theme:"string",OPACITY:"object",FONT_SIZE:"object",MARGIN:"object",SPEED:"object",COLOR:"array"}}static get cssText(){return'\n user-select: none;\n position: absolute;\n white-space: pre;\n pointer-events: none;\n perspective: 500px;\n display: inline-block;\n will-change: transform;\n font-weight: normal;\n line-height: 1.125;\n Line truncated
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "artplayer-plugin-danmuku",
|
||||
"version": "5.2.0",
|
||||
"version": "5.2.1",
|
||||
"description": "Danmuku plugin for ArtPlayer",
|
||||
"author": "Harvey Zhao <laozhaochaguan@gmail.com>",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import workerText from 'bundle-text:./worker'
|
||||
import { bilibiliDanmuParseFromUrl } from './bilibili'
|
||||
import DanmuWorker from './worker.js?worker&inline'
|
||||
|
||||
export default class Danmuku {
|
||||
constructor(art, option) {
|
||||
@@ -28,9 +28,7 @@ export default class Danmuku {
|
||||
this.config(option, true)
|
||||
|
||||
// 创建 Web Worker, 用于计算弹幕的 top 值
|
||||
const workerText2 = workerText.replace('export{e as default};', '')
|
||||
const blob = new Blob([workerText2], { type: 'application/javascript' })
|
||||
this.worker = new Worker(URL.createObjectURL(blob))
|
||||
this.worker = new DanmuWorker()
|
||||
|
||||
// 绑定公用事件
|
||||
this.start = this.start.bind(this)
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import $check_off from 'bundle-text:./img/check_off.svg'
|
||||
import $check_on from 'bundle-text:./img/check_on.svg'
|
||||
import $config from 'bundle-text:./img/config.svg'
|
||||
import $mode_0_off from 'bundle-text:./img/mode_0_off.svg'
|
||||
import $mode_0_on from 'bundle-text:./img/mode_0_on.svg'
|
||||
import $mode_1_off from 'bundle-text:./img/mode_1_off.svg'
|
||||
import $mode_1_on from 'bundle-text:./img/mode_1_on.svg'
|
||||
import $mode_2_off from 'bundle-text:./img/mode_2_off.svg'
|
||||
import $mode_2_on from 'bundle-text:./img/mode_2_on.svg'
|
||||
import $off from 'bundle-text:./img/off.svg'
|
||||
import $on from 'bundle-text:./img/on.svg'
|
||||
import $style from 'bundle-text:./img/style.svg'
|
||||
import style from 'bundle-text:./style.less'
|
||||
import $check_off from './img/check_off.svg?raw'
|
||||
import $check_on from './img/check_on.svg?raw'
|
||||
import $config from './img/config.svg?raw'
|
||||
import $mode_0_off from './img/mode_0_off.svg?raw'
|
||||
import $mode_0_on from './img/mode_0_on.svg?raw'
|
||||
import $mode_1_off from './img/mode_1_off.svg?raw'
|
||||
import $mode_1_on from './img/mode_1_on.svg?raw'
|
||||
import $mode_2_off from './img/mode_2_off.svg?raw'
|
||||
import $mode_2_on from './img/mode_2_on.svg?raw'
|
||||
import $off from './img/off.svg?raw'
|
||||
import $on from './img/on.svg?raw'
|
||||
import $style from './img/style.svg?raw'
|
||||
import style from './style.less?inline'
|
||||
|
||||
export default class Setting {
|
||||
constructor(art, danmuku) {
|
||||
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-dash-control.js v1.0.0
|
||||
* artplayer-plugin-dash-control.js v1.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,o,r,n){var i="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},u="function"==typeof i[r]&&i[r],l=u.i||{},a=u.cache||{},s="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,o){if(!a[t]){if(!e[t]){if(n[t])return n[t];var l="function"==typeof i[r]&&i[r];if(!o&&l)return l(t,!0);if(u)return u(t,!0);if(s&&"string"==typeof t)return s(t);var f=Error("Cannot find module '"+t+"'");throw f.code="MODULE_NOT_FOUND",f}p.resolve=function(o){var r=e[t][1][o];return null!=r?r:o},p.cache={};var c=a[t]=new d.Module(t);e[t][0].call(c.exports,p,c,c.exports,i)}return a[t].exports;function p(e){var t=p.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var o={__esModule:!0};return t.forEach(function(e){var t=e[0],r=e[1],n=e[2]||e[0],i=d(r);"*"===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]}})}):"*"===n?Object.defineProperty(o,t,{enumerable:!0,value:i}):Object.defineProperty(o,t,{enumerable:!0,get:function(){return"default"===n?i.__esModule?i.default:i:i[n]}})}),o}return d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.require=s,this.exports={}},d.modules=e,d.cache=a,d.parent=u,d.distDir=void 0,d.publicUrl=void 0,d.devServer=void 0,d.i=l,d.register=function(t,o){e[t]=[function(e,t){t.exports=o},{}]},Object.defineProperty(d,"root",{get:function(){return i[r]}}),i[r]=d;for(var f=0;f<t.length;f++)d(t[f]);if(o){var c=d(o);"object"==typeof exports&&"u">typeof module?module.exports=c:"function"==typeof define&&define.amd&&define(function(){return c})}}({fpgdj:[function(e,t,o,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(o),n.export(o,"default",()=>d);var i=e("bundle-text:./audio.svg"),u=n.interopDefault(i),l=e("bundle-text:./quality.svg"),a=n.interopDefault(l);function s(e,t){let o=new Map;return e.filter(e=>{let r=e[t];return void 0===r||!o.has(r)&&o.set(r,1)})}function d(e={}){return t=>{let{$video:o}=t.template,{errorHandle:r}=t.constructor.utils;function n(){r(t.dash.getVideoElement()===o,'Cannot find instance of DASH from "art.dash"'),function(o){let r=o.getBitrateInfoListFor("video");if(!r||!r.length)return;let n=e.quality||{},i=n.auto||"Auto",u=n.title||"Quality",l=n.getName||(e=>`${e.height}p`),d=o.getQualityFor("video"),f=o.getSettings().streaming.abr.autoSwitchBitrate.video,c=f?i:l(r[d]),p=s(r.map(e=>({html:l(e),value:e.qualityIndex,default:d===e.qualityIndex&&!f})),"html").sort((e,t)=>t.value-e.value);p.push({html:i,value:"auto",default:f});let h=e=>("auto"===e.value?o.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!0}}}}):(o.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!1}}}}),o.setQualityFor("video",e.value)),t.notice.show=`${u}: ${e.html}`,n.control&&t.controls.check(e),n.setting&&t.setting.check(e),e.html);n.control&&t.controls.update({name:"dash-quality",position:"right",html:c,style:{padding:"0 10px"},selector:p,onSelect:h}),n.setting&&t.setting.update({name:"dash-quality",tooltip:c,html:u,icon:a.default,width:200,selector:p,onSelect:h})}(t.dash),function(o){let r=o.getTracksFor("audio");if(!r||!r.length)return;let n=e.audio||{},i=n.auto||"Auto",l=n.title||"Audio",a=n.getName||(e=>e.lang||e.id),d=o.getCurrentTrackFor("audio")||r[0],f=d?a(d):i,c=s(r.map(e=>({html:a(e),value:e,default:d===e})),"html"),p=e=>(o.setCurrentTrack(e.value),t.notice.show=`${l}: ${e.html}`,n.control&&t.controls.check(e),n.setting&&t.setting.check(e),e.html);n.control&&t.controls.update({name:"dash-audio",position:"right",html:f,style:{padding:"0 10px"},selector:c,onSelect:p}),n.setting&&t.setting.update({name:"dash-audio",tooltip:f,html:l,icon:u.default,width:200,selector:c,onSelect:p})}(t.dash)}return t.on("ready",n),t.on("restart",n),{name:"artplayerPluginDashControl",update:n}}}"u">typeof window&&(window.artplayerPluginDashControl=d)},{"bundle-text:./audio.svg":"h5IJQ","bundle-text:./quality.svg":"04OQC","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],h5IJQ:[function(e,t,o,r){t.exports='<svg xmlns="http://www.w3.org/2000/svg" height="18" viewBox="0 0 512 512"><path fill="#fff" d="M256 80C149.9 80 62.4 159.4 49.6 262c9.4-3.8 19.6-6 30.4-6 26.5 0 48 21.5 48 48v128c0 26.5-21.5 48-48 48-44.2 0-80-35.8-80-80V288C0 146.6 114.6 32 256 32s256 114.6 256 256v112c0 44.2-35.8 80-80 80-26.5 0-48-21.5-48-48V304c0-26.5 21.5-48 48-48 10.8 0 21 2.1 30.4 6C449.6 159.4 362.1 80 256 80"/></svg>'},{}],"04OQC":[function(e,t,o,r){t.exports='<svg xmlns="http://www.w3.org/2000/svg" height="18" viewBox="0 0 512 512"><path fill="#fff" d="M0 96c0-35.3 28.7-64 64-64h384c35.3 0 64 28.7 64 64v320c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64Zm323.8 106.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6-26.5-33.1c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4S78.8 416 88 416h336c8.9 0 17.1-4.9 21.Line truncated
|
||||
!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.ArtplayerPluginDashControl=e(),define(function(){return t.ArtplayerPluginDashControl})):(t="undefined"!==typeof globalThis?globalThis:t||self).ArtplayerPluginDashControl=e()}(this,function(){"use strict";function t(t,e){const o=new Map;return t.filter(t=>{const n=t[e];return void 0===n||!o.has(n)&&o.set(n,1)})}function e(e={}){return o=>{const{$video:n}=o.template,{errorHandle:i}=o.constructor.utils;function a(){i(o.dash.getVideoElement()===n,'Cannot find instance of DASH from "art.dash"'),function(n){const i=n.getBitrateInfoListFor("video");if(!i||!i.length)return;const a=e.quality||{},l=a.auto||"Auto",s=a.title||"Quality",r=a.getName||(t=>`${t.height}p`),c=n.getQualityFor("video"),u=n.getSettings().streaming.abr.autoSwitchBitrate.video,d=u?l:r(i[c]),h=t(i.map(t=>({html:r(t),value:t.qualityIndex,default:c===t.qualityIndex&&!u})),"html").sort((t,e)=>e.value-t.value);h.push({html:l,value:"auto",default:u});const g=t=>("auto"===t.value?n.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!0}}}}):(n.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!1}}}}),n.setQualityFor("video",t.value)),o.notice.show=`${s}: ${t.html}`,a.control&&o.controls.check(t),a.setting&&o.setting.check(t),t.html);a.control&&o.controls.update({name:"dash-quality",position:"right",html:d,style:{padding:"0 10px"},selector:h,onSelect:g}),a.setting&&o.setting.update({name:"dash-quality",tooltip:d,html:s,icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" height="18"><path fill="#fff" d="M0 96C0 60.7 28.7 32 64 32l384 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6l96 0 32 0 208 0c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"/></svg>',width:200,selector:h,onSelect:g})}(o.dash),function(n){const i=n.getTracksFor("audio");if(!i||!i.length)return;const a=e.audio||{},l=a.auto||"Auto",s=a.title||"Audio",r=a.getName||(t=>t.lang||t.id),c=n.getCurrentTrackFor("audio")||i[0],u=c?r(c):l,d=t(i.map(t=>({html:r(t),value:t,default:c===t})),"html"),h=t=>(n.setCurrentTrack(t.value),o.notice.show=`${s}: ${t.html}`,a.control&&o.controls.check(t),a.setting&&o.setting.check(t),t.html);a.control&&o.controls.update({name:"dash-audio",position:"right",html:u,style:{padding:"0 10px"},selector:d,onSelect:h}),a.setting&&o.setting.update({name:"dash-audio",tooltip:u,html:s,icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" height="18"><path fill="#fff" d="M256 80C149.9 80 62.4 159.4 49.6 262c9.4-3.8 19.6-6 30.4-6c26.5 0 48 21.5 48 48l0 128c0 26.5-21.5 48-48 48c-44.2 0-80-35.8-80-80l0-16 0-48 0-48C0 146.6 114.6 32 256 32s256 114.6 256 256l0 48 0 48 0 16c0 44.2-35.8 80-80 80c-26.5 0-48-21.5-48-48l0-128c0-26.5 21.5-48 48-48c10.8 0 21 2.1 30.4 6C449.6 159.4 362.1 80 256 80z"/></svg>',width:200,selector:d,onSelect:h})}(o.dash)}return o.on("ready",a),o.on("restart",a),{name:"artplayerPluginDashControl",update:a}}}return"undefined"!==typeof window&&(window.artplayerPluginDashControl=e),e});
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-dash-control.js v1.0.0
|
||||
* artplayer-plugin-dash-control.js v1.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,o,n,r){var i="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},u="function"==typeof i[n]&&i[n],a=u.i||{},l=u.cache||{},c="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,o){if(!l[t]){if(!e[t]){if(r[t])return r[t];var a="function"==typeof i[n]&&i[n];if(!o&&a)return a(t,!0);if(u)return u(t,!0);if(c&&"string"==typeof t)return c(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}p.resolve=function(o){var n=e[t][1][o];return null!=n?n:o},p.cache={};var d=l[t]=new f.Module(t);e[t][0].call(d.exports,p,d,d.exports,i)}return l[t].exports;function p(e){var t=p.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=f(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 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=l,f.parent=u,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=a,f.register=function(t,o){e[t]=[function(e,t){t.exports=o},{}]},Object.defineProperty(f,"root",{get:function(){return i[n]}}),i[n]=f;for(var s=0;s<t.length;s++)f(t[s]);if(o){var d=f(o);"object"==typeof exports&&"u">typeof module?module.exports=d:"function"==typeof define&&define.amd&&define(function(){return d})}}({SomuF:[function(e,t,o,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(o),r.export(o,"default",function(){return f});var i=e("bundle-text:./audio.svg"),u=r.interopDefault(i),a=e("bundle-text:./quality.svg"),l=r.interopDefault(a);function c(e,t){var o=new Map;return e.filter(function(e){var n=e[t];return void 0===n||!o.has(n)&&o.set(n,1)})}function f(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t){var o=t.template.$video,n=t.constructor.utils.errorHandle;function r(){n(t.dash.getVideoElement()===o,'Cannot find instance of DASH from "art.dash"'),function(o){var n=o.getBitrateInfoListFor("video");if(n&&n.length){var r=e.quality||{},i=r.auto||"Auto",u=r.title||"Quality",a=r.getName||function(e){return"".concat(e.height,"p")},f=o.getQualityFor("video"),s=o.getSettings().streaming.abr.autoSwitchBitrate.video,d=s?i:a(n[f]),p=c(n.map(function(e){return{html:a(e),value:e.qualityIndex,default:f===e.qualityIndex&&!s}}),"html").sort(function(e,t){return t.value-e.value});p.push({html:i,value:"auto",default:s});var h=function(e){return"auto"===e.value?o.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!0}}}}):(o.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!1}}}}),o.setQualityFor("video",e.value)),t.notice.show="".concat(u,": ").concat(e.html),r.control&&t.controls.check(e),r.setting&&t.setting.check(e),e.html};r.control&&t.controls.update({name:"dash-quality",position:"right",html:d,style:{padding:"0 10px"},selector:p,onSelect:h}),r.setting&&t.setting.update({name:"dash-quality",tooltip:d,html:u,icon:l.default,width:200,selector:p,onSelect:h})}}(t.dash),function(o){var n=o.getTracksFor("audio");if(n&&n.length){var r=e.audio||{},i=r.auto||"Auto",a=r.title||"Audio",l=r.getName||function(e){return e.lang||e.id},f=o.getCurrentTrackFor("audio")||n[0],s=f?l(f):i,d=c(n.map(function(e){return{html:l(e),value:e,default:f===e}}),"html"),p=function(e){return o.setCurrentTrack(e.value),t.notice.show="".concat(a,": ").concat(e.html),r.control&&t.controls.check(e),r.setting&&t.setting.check(e),e.html};r.control&&t.controls.update({name:"dash-audio",position:"right",html:s,style:{padding:"0 10px"},selector:d,onSelect:p}),r.setting&&t.setting.update({name:"dash-audio",tooltip:s,html:a,icon:u.default,width:200,selector:d,onSelect:p})}}(t.dash)}return t.on("ready",r),t.on("restart",r),{name:"artplayerPluginDashControl",update:r}}}"u">typeof window&&(window.artplayerPluginDashControl=f)},{"bundle-text:./audio.svg":"4hXZr","bundle-text:./quality.svg":"8Ayoe","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],"4hXZr":[function(e,t,o,n){t.exports='<svg xmlns="http://www.w3.org/2000/svg" height="18" viewBox="0 0 512 512"><path fill="#fff" d="M256 80C149.9 80 62.4 159.4 49.6 262c9.4-3.8 19.6-6 30.4-6 26.5 0 48 21.5 48 48v128c0 26.5-21.5 48-48 48-44.2 0-80-35.8-80-80V288C0 146.6 114.6 32 256 32s256 114.6 256 256v112c0 44.2-35.8 80-80 80-26.5 0-48-21.5-48-48V304c0-26.5 21.5-48 48-48 10.8 0 21 2.1 30.4 6C449.6 159.4 362.1 80 256 80"/></svg>'},{}],"8Ayoe":[function(e,t,o,n){t.exports='<svg xmlns="http://www.w3.org/2000/svg" height="18" viewBox="0 0 512 512"><path fill="#fff" d="M0 96c0-35.3 28.7-64 64-64h384c35.3 0 64 28.7 64 64v320c0 35.3-28.7 64-64 64H64cLine truncated
|
||||
!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.ArtplayerPluginDashControl=e(),define(function(){return t.ArtplayerPluginDashControl})):(t="undefined"!==typeof globalThis?globalThis:t||self).ArtplayerPluginDashControl=e()}(this,function(){"use strict";function t(t,e){const o=new Map;return t.filter(t=>{const n=t[e];return void 0===n||!o.has(n)&&o.set(n,1)})}function e(e={}){return o=>{const{$video:n}=o.template,{errorHandle:i}=o.constructor.utils;function a(){i(o.dash.getVideoElement()===n,'Cannot find instance of DASH from "art.dash"'),function(n){const i=n.getBitrateInfoListFor("video");if(!i||!i.length)return;const a=e.quality||{},l=a.auto||"Auto",s=a.title||"Quality",r=a.getName||(t=>`${t.height}p`),c=n.getQualityFor("video"),u=n.getSettings().streaming.abr.autoSwitchBitrate.video,d=u?l:r(i[c]),h=t(i.map(t=>({html:r(t),value:t.qualityIndex,default:c===t.qualityIndex&&!u})),"html").sort((t,e)=>e.value-t.value);h.push({html:l,value:"auto",default:u});const g=t=>("auto"===t.value?n.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!0}}}}):(n.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!1}}}}),n.setQualityFor("video",t.value)),o.notice.show=`${s}: ${t.html}`,a.control&&o.controls.check(t),a.setting&&o.setting.check(t),t.html);a.control&&o.controls.update({name:"dash-quality",position:"right",html:d,style:{padding:"0 10px"},selector:h,onSelect:g}),a.setting&&o.setting.update({name:"dash-quality",tooltip:d,html:s,icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" height="18"><path fill="#fff" d="M0 96C0 60.7 28.7 32 64 32l384 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6l96 0 32 0 208 0c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"/></svg>',width:200,selector:h,onSelect:g})}(o.dash),function(n){const i=n.getTracksFor("audio");if(!i||!i.length)return;const a=e.audio||{},l=a.auto||"Auto",s=a.title||"Audio",r=a.getName||(t=>t.lang||t.id),c=n.getCurrentTrackFor("audio")||i[0],u=c?r(c):l,d=t(i.map(t=>({html:r(t),value:t,default:c===t})),"html"),h=t=>(n.setCurrentTrack(t.value),o.notice.show=`${s}: ${t.html}`,a.control&&o.controls.check(t),a.setting&&o.setting.check(t),t.html);a.control&&o.controls.update({name:"dash-audio",position:"right",html:u,style:{padding:"0 10px"},selector:d,onSelect:h}),a.setting&&o.setting.update({name:"dash-audio",tooltip:u,html:s,icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" height="18"><path fill="#fff" d="M256 80C149.9 80 62.4 159.4 49.6 262c9.4-3.8 19.6-6 30.4-6c26.5 0 48 21.5 48 48l0 128c0 26.5-21.5 48-48 48c-44.2 0-80-35.8-80-80l0-16 0-48 0-48C0 146.6 114.6 32 256 32s256 114.6 256 256l0 48 0 48 0 16c0 44.2-35.8 80-80 80c-26.5 0-48-21.5-48-48l0-128c0-26.5 21.5-48 48-48c10.8 0 21 2.1 30.4 6C449.6 159.4 362.1 80 256 80z"/></svg>',width:200,selector:d,onSelect:h})}(o.dash)}return o.on("ready",a),o.on("restart",a),{name:"artplayerPluginDashControl",update:a}}}return"undefined"!==typeof window&&(window.artplayerPluginDashControl=e),e});
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-dash-control.js v1.0.0
|
||||
* artplayer-plugin-dash-control.js v1.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,o,r,n){var i="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},u="function"==typeof i[r]&&i[r],l=u.i||{},a=u.cache||{},s="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,o){if(!a[t]){if(!e[t]){if(n[t])return n[t];var l="function"==typeof i[r]&&i[r];if(!o&&l)return l(t,!0);if(u)return u(t,!0);if(s&&"string"==typeof t)return s(t);var d=Error("Cannot find module '"+t+"'");throw d.code="MODULE_NOT_FOUND",d}p.resolve=function(o){var r=e[t][1][o];return null!=r?r:o},p.cache={};var f=a[t]=new c.Module(t);e[t][0].call(f.exports,p,f,f.exports,i)}return a[t].exports;function p(e){var t=p.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var o={__esModule:!0};return t.forEach(function(e){var t=e[0],r=e[1],n=e[2]||e[0],i=c(r);"*"===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]}})}):"*"===n?Object.defineProperty(o,t,{enumerable:!0,value:i}):Object.defineProperty(o,t,{enumerable:!0,get:function(){return"default"===n?i.__esModule?i.default:i:i[n]}})}),o}return c(t)}}c.isParcelRequire=!0,c.Module=function(e){this.id=e,this.bundle=c,this.require=s,this.exports={}},c.modules=e,c.cache=a,c.parent=u,c.distDir=void 0,c.publicUrl=void 0,c.devServer=void 0,c.i=l,c.register=function(t,o){e[t]=[function(e,t){t.exports=o},{}]},Object.defineProperty(c,"root",{get:function(){return i[r]}}),i[r]=c;for(var d=0;d<t.length;d++)c(t[d]);if(o){var f=c(o);"object"==typeof exports&&"u">typeof module?module.exports=f:"function"==typeof define&&define.amd&&define(function(){return f})}}({"2mXm2":[function(e,t,o,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(o),n.export(o,"default",()=>c);var i=e("bundle-text:./audio.svg"),u=n.interopDefault(i),l=e("bundle-text:./quality.svg"),a=n.interopDefault(l);function s(e,t){let o=new Map;return e.filter(e=>{let r=e[t];return void 0===r||!o.has(r)&&o.set(r,1)})}function c(e={}){return t=>{let{$video:o}=t.template,{errorHandle:r}=t.constructor.utils;function n(){r(t.dash.getVideoElement()===o,'Cannot find instance of DASH from "art.dash"'),function(o){let r=o.getBitrateInfoListFor("video");if(!r||!r.length)return;let n=e.quality||{},i=n.auto||"Auto",u=n.title||"Quality",l=n.getName||(e=>`${e.height}p`),c=o.getQualityFor("video"),d=o.getSettings().streaming.abr.autoSwitchBitrate.video,f=d?i:l(r[c]),p=s(r.map(e=>({html:l(e),value:e.qualityIndex,default:c===e.qualityIndex&&!d})),"html").sort((e,t)=>t.value-e.value);p.push({html:i,value:"auto",default:d});let h=e=>("auto"===e.value?o.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!0}}}}):(o.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!1}}}}),o.setQualityFor("video",e.value)),t.notice.show=`${u}: ${e.html}`,n.control&&t.controls.check(e),n.setting&&t.setting.check(e),e.html);n.control&&t.controls.update({name:"dash-quality",position:"right",html:f,style:{padding:"0 10px"},selector:p,onSelect:h}),n.setting&&t.setting.update({name:"dash-quality",tooltip:f,html:u,icon:a.default,width:200,selector:p,onSelect:h})}(t.dash),function(o){let r=o.getTracksFor("audio");if(!r||!r.length)return;let n=e.audio||{},i=n.auto||"Auto",l=n.title||"Audio",a=n.getName||(e=>e.lang||e.id),c=o.getCurrentTrackFor("audio")||r[0],d=c?a(c):i,f=s(r.map(e=>({html:a(e),value:e,default:c===e})),"html"),p=e=>(o.setCurrentTrack(e.value),t.notice.show=`${l}: ${e.html}`,n.control&&t.controls.check(e),n.setting&&t.setting.check(e),e.html);n.control&&t.controls.update({name:"dash-audio",position:"right",html:d,style:{padding:"0 10px"},selector:f,onSelect:p}),n.setting&&t.setting.update({name:"dash-audio",tooltip:d,html:l,icon:u.default,width:200,selector:f,onSelect:p})}(t.dash)}return t.on("ready",n),t.on("restart",n),{name:"artplayerPluginDashControl",update:n}}}"u">typeof window&&(window.artplayerPluginDashControl=c)},{"bundle-text:./audio.svg":"8JwGn","bundle-text:./quality.svg":"gADLz","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],"8JwGn":[function(e,t,o,r){t.exports='<svg xmlns="http://www.w3.org/2000/svg" height="18" viewBox="0 0 512 512"><path fill="#fff" d="M256 80C149.9 80 62.4 159.4 49.6 262c9.4-3.8 19.6-6 30.4-6 26.5 0 48 21.5 48 48v128c0 26.5-21.5 48-48 48-44.2 0-80-35.8-80-80V288C0 146.6 114.6 32 256 32s256 114.6 256 256v112c0 44.2-35.8 80-80 80-26.5 0-48-21.5-48-48V304c0-26.5 21.5-48 48-48 10.8 0 21 2.1 30.4 6C449.6 159.4 362.1 80 256 80"/></svg>'},{}],gADLz:[function(e,t,o,r){t.exports='<svg xmlns="http://www.w3.org/2000/svg" height="18" viewBox="0 0 512 512"><path fill="#fff" d="M0 96c0-35.3 28.7-64 64-64h384c35.3 0 64 28.7 64 64v320c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64Zm323.8 106.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6-26.5-33.1c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4S78.8 416 88 416h336c8.9 0 17.1-4.9 2Line truncated
|
||||
function t(t,e){const o=/* @__PURE__ */new Map;return t.filter(t=>{const n=t[e];return void 0===n||!o.has(n)&&o.set(n,1)})}function e(e={}){return o=>{const{$video:n}=o.template,{errorHandle:a}=o.constructor.utils;function i(){a(o.dash.getVideoElement()===n,'Cannot find instance of DASH from "art.dash"'),function(n){const a=n.getBitrateInfoListFor("video");if(!a||!a.length)return;const i=e.quality||{},l=i.auto||"Auto",s=i.title||"Quality",r=i.getName||(t=>`${t.height}p`),c=n.getQualityFor("video"),u=n.getSettings().streaming.abr.autoSwitchBitrate.video,d=u?l:r(a[c]),h=t(a.map(t=>({html:r(t),value:t.qualityIndex,default:c===t.qualityIndex&&!u})),"html").sort((t,e)=>e.value-t.value);h.push({html:l,value:"auto",default:u});const g=t=>("auto"===t.value?n.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!0}}}}):(n.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!1}}}}),n.setQualityFor("video",t.value)),o.notice.show=`${s}: ${t.html}`,i.control&&o.controls.check(t),i.setting&&o.setting.check(t),t.html);i.control&&o.controls.update({name:"dash-quality",position:"right",html:d,style:{padding:"0 10px"},selector:h,onSelect:g}),i.setting&&o.setting.update({name:"dash-quality",tooltip:d,html:s,icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" height="18"><path fill="#fff" d="M0 96C0 60.7 28.7 32 64 32l384 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6l96 0 32 0 208 0c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"/></svg>',width:200,selector:h,onSelect:g})}(o.dash),function(n){const a=n.getTracksFor("audio");if(!a||!a.length)return;const i=e.audio||{},l=i.auto||"Auto",s=i.title||"Audio",r=i.getName||(t=>t.lang||t.id),c=n.getCurrentTrackFor("audio")||a[0],u=c?r(c):l,d=t(a.map(t=>({html:r(t),value:t,default:c===t})),"html"),h=t=>(n.setCurrentTrack(t.value),o.notice.show=`${s}: ${t.html}`,i.control&&o.controls.check(t),i.setting&&o.setting.check(t),t.html);i.control&&o.controls.update({name:"dash-audio",position:"right",html:u,style:{padding:"0 10px"},selector:d,onSelect:h}),i.setting&&o.setting.update({name:"dash-audio",tooltip:u,html:s,icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" height="18"><path fill="#fff" d="M256 80C149.9 80 62.4 159.4 49.6 262c9.4-3.8 19.6-6 30.4-6c26.5 0 48 21.5 48 48l0 128c0 26.5-21.5 48-48 48c-44.2 0-80-35.8-80-80l0-16 0-48 0-48C0 146.6 114.6 32 256 32s256 114.6 256 256l0 48 0 48 0 16c0 44.2-35.8 80-80 80c-26.5 0-48-21.5-48-48l0-128c0-26.5 21.5-48 48-48c10.8 0 21 2.1 30.4 6C449.6 159.4 362.1 80 256 80z"/></svg>',width:200,selector:d,onSelect:h})}(o.dash)}return o.on("ready",i),o.on("restart",i),{name:"artplayerPluginDashControl",update:i}}}"undefined"!==typeof window&&(window.artplayerPluginDashControl=e);export{e as default};
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "artplayer-plugin-dash-control",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "Dash control plugin for ArtPlayer",
|
||||
"author": "Harvey Zhao <laozhaochaguan@gmail.com>",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import $audio from 'bundle-text:./audio.svg'
|
||||
import $quality from 'bundle-text:./quality.svg'
|
||||
import $audio from './audio.svg?raw'
|
||||
import $quality from './quality.svg?raw'
|
||||
|
||||
function uniqBy(array, property) {
|
||||
const seen = new Map()
|
||||
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-document-pip.js v1.0.2
|
||||
* artplayer-plugin-document-pip.js v1.0.3
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,r,o){var i="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},l="function"==typeof i[r]&&i[r],a=l.i||{},d=l.cache||{},c="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(t,n){if(!d[t]){if(!e[t]){if(o[t])return o[t];var a="function"==typeof i[r]&&i[r];if(!n&&a)return a(t,!0);if(l)return l(t,!0);if(c&&"string"==typeof t)return c(t);var p=Error("Cannot find module '"+t+"'");throw p.code="MODULE_NOT_FOUND",p}f.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},f.cache={};var s=d[t]=new u.Module(t);e[t][0].call(s.exports,f,s,s.exports,i)}return d[t].exports;function f(e){var t=f.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],i=u(r);"*"===t?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===o?Object.defineProperty(n,t,{enumerable:!0,value:i}):Object.defineProperty(n,t,{enumerable:!0,get:function(){return"default"===o?i.__esModule?i.default:i:i[o]}})}),n}return u(t)}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.require=c,this.exports={}},u.modules=e,u.cache=d,u.parent=l,u.distDir=void 0,u.publicUrl=void 0,u.devServer=void 0,u.i=a,u.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(u,"root",{get:function(){return i[r]}}),i[r]=u;for(var p=0;p<t.length;p++)u(t[p]);if(n){var s=u(n);"object"==typeof exports&&"u">typeof module?module.exports=s:"function"==typeof define&&define.amd&&define(function(){return s})}}({eo8f0:[function(e,t,n,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(n),o.export(n,"default",()=>a);var i=e("bundle-text:./style.less"),l=o.interopDefault(i);function a(e={}){let t={width:480,height:270,fallbackToVideoPiP:!0,placeholder:"Playing in Document Picture-in-Picture",...e};return e=>{let n="documentPictureInPicture"in window&&"function"==typeof window.documentPictureInPicture?.requestWindow,{proxy:r,icons:o,i18n:i,template:{$player:l},constructor:{utils:{append:a,tooltip:d,addClass:c,removeClass:u,sleep:p}}}=e,s={win:null,originalParent:null,originalNext:null,currentDoc:null,placeholder:null};async function f(){if(!n&&t.fallbackToVideoPiP){e.pip=!0,console.warn("[artplayer-plugin-document-pip] Document Picture-in-Picture is not supported, falling back to Video Picture-in-Picture");return}if(!s.win)try{let n=await window.documentPictureInPicture.requestWindow({width:t.width,height:t.height});s.win=n,s.currentDoc=n.document,s.placeholder=document.createElement("div"),s.placeholder.className="artplayer-document-pip-placeholder",s.placeholder.style.cssText="display:flex;justify-content:center;align-items:center;width:100%;height:100%;",s.placeholder.textContent=t.placeholder,s.originalParent=l.parentNode,s.originalNext=l.nextSibling,s.originalParent.insertBefore(s.placeholder,s.originalNext);let o=n.document.createElement("div");o.id="__art_dpip_root",n.document.body.appendChild(o);var r=n.document;let i=r.createElement("style");if(i.textContent=` html, body { margin:0; padding:0; width:100%; height:100%; background:#000; overflow:hidden; } #__art_dpip_root { position:absolute; inset:0; display:flex; } #__art_dpip_root > * { width:100% !important; height:100% !important; } `,r.head.appendChild(i),!r.querySelector('meta[name="viewport"]')){let e=r.createElement("meta");e.name="viewport",e.content="width=device-width,initial-scale=1",r.head.appendChild(e)}try{document.querySelectorAll('link[rel="stylesheet"]').forEach(e=>{let t=r.createElement("link");t.rel="stylesheet",t.href=e.href,e.media&&(t.media=e.media),e.crossOrigin&&(t.crossOrigin=e.crossOrigin),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),r.head.appendChild(t)})}catch{}try{document.querySelectorAll("style").forEach(e=>{let t=r.createElement("style");t.textContent=e.textContent,r.head.appendChild(t)})}catch{}let a=n.document.adoptNode(l);o.appendChild(a),s.currentDoc=n.document;let d=()=>e.resize?.(),u=()=>m();n.addEventListener("resize",d),n.addEventListener("pagehide",u),n.addEventListener("unload",u),s.cleanup=()=>{n.removeEventListener("resize",d),n.removeEventListener("pagehide",u),n.removeEventListener("unload",u)},c(l,"artplayer-document-pip"),e.events.bindGlobalEvents?.(),e.emit("document-pip",!0),await p(100),e.emit("resize")}catch(t){e.notice.show="Document Picture-in-Picture open failed",console.warn("[artplayer-plugin-document-pip] open failed:",t)}}async function m(){if(s.win)try{s.cleanup?.(),function(){if(!s.placeholder)return;let e=s.placeholder.ownerDocument||document,t=e.adoptNode(l);s.originalParent.insertBefore(t,s.placeholder),s.placeholder.remove(),s.placeholder=null,s.currentDoc=e}(),s.win.close(),s.win=null,u(l,"artplayer-document-pip"),e.events.bindGlobalEvents?.(),e.emit("document-pLine truncated
|
||||
!function(e,t){"object"===typeof exports&&"undefined"!==typeof module?module.exports=t():"function"==typeof define&&define.amd?(t.ArtplayerPluginDocumentPip=t(),define(function(){return t.ArtplayerPluginDocumentPip})):(e="undefined"!==typeof globalThis?globalThis:e||self).ArtplayerPluginDocumentPip=t()}(this,function(){"use strict";function e(e={}){const t={width:480,height:270,fallbackToVideoPiP:!0,placeholder:"Playing in Document Picture-in-Picture",...e};return e=>{const n="documentPictureInPicture"in window&&"function"===typeof window.documentPictureInPicture?.requestWindow,{proxy:i,icons:o,i18n:r,template:{$player:d},constructor:{utils:{append:l,tooltip:c,addClass:a,removeClass:p,sleep:u}}}=e,s={win:null,originalParent:null,originalNext:null,currentDoc:null,placeholder:null};async function m(){if(!n&&t.fallbackToVideoPiP)return e.pip=!0,void console.warn("[artplayer-plugin-document-pip] Document Picture-in-Picture is not supported, falling back to Video Picture-in-Picture");if(!s.win)try{const n=await window.documentPictureInPicture.requestWindow({width:t.width,height:t.height});s.win=n,s.currentDoc=n.document,s.placeholder=document.createElement("div"),s.placeholder.className="artplayer-document-pip-placeholder",s.placeholder.style.cssText="display:flex;justify-content:center;align-items:center;width:100%;height:100%;",s.placeholder.textContent=t.placeholder,s.originalParent=d.parentNode,s.originalNext=d.nextSibling,s.originalParent.insertBefore(s.placeholder,s.originalNext);const i=n.document.createElement("div");i.id="__art_dpip_root",n.document.body.appendChild(i),function(e){const t=e.createElement("style");if(t.textContent="\n html, body { margin:0; padding:0; width:100%; height:100%; background:#000; overflow:hidden; }\n #__art_dpip_root { position:absolute; inset:0; display:flex; }\n #__art_dpip_root > * { width:100% !important; height:100% !important; }\n ",e.head.appendChild(t),!e.querySelector('meta[name="viewport"]')){const t=e.createElement("meta");t.name="viewport",t.content="width=device-width,initial-scale=1",e.head.appendChild(t)}try{document.querySelectorAll('link[rel="stylesheet"]').forEach(t=>{const n=e.createElement("link");n.rel="stylesheet",n.href=t.href,t.media&&(n.media=t.media),t.crossOrigin&&(n.crossOrigin=t.crossOrigin),t.referrerPolicy&&(n.referrerPolicy=t.referrerPolicy),e.head.appendChild(n)})}catch{}try{document.querySelectorAll("style").forEach(t=>{const n=e.createElement("style");n.textContent=t.textContent,e.head.appendChild(n)})}catch{}}(n.document);const o=n.document.adoptNode(d);i.appendChild(o),s.currentDoc=n.document;const r=()=>e.resize?.(),l=()=>h();n.addEventListener("resize",r),n.addEventListener("pagehide",l),n.addEventListener("unload",l),s.cleanup=()=>{n.removeEventListener("resize",r),n.removeEventListener("pagehide",l),n.removeEventListener("unload",l)},a(d,"artplayer-document-pip"),e.events.bindGlobalEvents?.(),e.emit("document-pip",!0),await u(100),e.emit("resize")}catch(i){e.notice.show="Document Picture-in-Picture open failed",console.warn("[artplayer-plugin-document-pip] open failed:",i)}}async function h(){if(s.win)try{s.cleanup?.(),function(){if(!s.placeholder)return;const e=s.placeholder.ownerDocument||document,t=e.adoptNode(d);s.originalParent.insertBefore(t,s.placeholder),s.placeholder.remove(),s.placeholder=null,s.currentDoc=e}(),s.win.close(),s.win=null,p(d,"artplayer-document-pip"),e.events.bindGlobalEvents?.(),e.emit("document-pip",!1),await u(100),e.emit("resize")}catch(t){e.notice.show="Document Picture-in-Picture close failed",console.warn("[artplayer-plugin-document-pip] close failed:",t)}}function f(){s.win?h():m()}return e.controls.add({name:"document-pip",position:"right",index:40,tooltip:e.i18n.get("PIP Mode"),mounted:t=>{l(t,o.pip),i(t,"click",f),e.on("document-pip",e=>{c(t,r.get(e?"Exit PIP Mode":"PIP Mode"))})}}),e.on("destroy",h),{name:"artplayerPluginDocumentPip",get isSupported(){return n},get isActive(){return!!s.win},open:m,close:h,toggle:f}}}if("undefined"!==typeof window&&(window.artplayerPluginDocumentPip=e),"undefined"!==typeof document){const e="artplayer-plugin-document-pip";let t=document.getElementById(e);t||(t=document.createElement("style"),t.id=e,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{document.head.appendChild(t)}):(document.head||document.documentElement).appendChild(t)),t.textContent=".artplayer-document-pip.art-video-player{width:100%!important;height:100%!important}"}return e});
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-document-pip.js v1.0.2
|
||||
* artplayer-plugin-document-pip.js v1.0.3
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,r,o){var i="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},l="function"==typeof i[r]&&i[r],c=l.i||{},u=l.cache||{},a="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,n){if(!u[t]){if(!e[t]){if(o[t])return o[t];var c="function"==typeof i[r]&&i[r];if(!n&&c)return c(t,!0);if(l)return l(t,!0);if(a&&"string"==typeof t)return a(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}f.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},f.cache={};var p=u[t]=new d.Module(t);e[t][0].call(p.exports,f,p,p.exports,i)}return u[t].exports;function f(e){var t=f.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],i=d(r);"*"===t?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===o?Object.defineProperty(n,t,{enumerable:!0,value:i}):Object.defineProperty(n,t,{enumerable:!0,get:function(){return"default"===o?i.__esModule?i.default:i:i[o]}})}),n}return d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.require=a,this.exports={}},d.modules=e,d.cache=u,d.parent=l,d.distDir=void 0,d.publicUrl=void 0,d.devServer=void 0,d.i=c,d.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(d,"root",{get:function(){return i[r]}}),i[r]=d;for(var s=0;s<t.length;s++)d(t[s]);if(n){var p=d(n);"object"==typeof exports&&"u">typeof module?module.exports=p:"function"==typeof define&&define.amd&&define(function(){return p})}}({"5Wzsp":[function(e,t,n,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(n),o.export(n,"default",function(){return d});var i=e("@swc/helpers/cjs/_async_to_generator.cjs"),l=e("@swc/helpers/cjs/_object_spread.cjs"),c=e("@swc/helpers/cjs/_ts_generator.cjs"),u=e("bundle-text:./style.less"),a=o.interopDefault(u);function d(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(0,l._)({width:480,height:270,fallbackToVideoPiP:!0,placeholder:"Playing in Document Picture-in-Picture"},e);return function(e){var n,r="documentPictureInPicture"in window&&"function"==typeof(null==(n=window.documentPictureInPicture)?void 0:n.requestWindow),o=e.proxy,l=e.icons,u=e.i18n,a=e.template.$player,d=e.constructor.utils,s=d.append,p=d.tooltip,f=d.addClass,h=d.removeClass,m=d.sleep,y={win:null,originalParent:null,originalNext:null,currentDoc:null,placeholder:null};function v(){return(0,i._)(function(){var n,o,i,l,u,d,s,p;return(0,c._)(this,function(c){switch(c.label){case 0:if(!r&&t.fallbackToVideoPiP)return e.pip=!0,console.warn("[artplayer-plugin-document-pip] Document Picture-in-Picture is not supported, falling back to Video Picture-in-Picture"),[2];if(y.win)return[2];c.label=1;case 1:return c.trys.push([1,4,,5]),[4,window.documentPictureInPicture.requestWindow({width:t.width,height:t.height})];case 2:y.win=i=c.sent(),y.currentDoc=i.document,y.placeholder=document.createElement("div"),y.placeholder.className="artplayer-document-pip-placeholder",y.placeholder.style.cssText="display:flex;justify-content:center;align-items:center;width:100%;height:100%;",y.placeholder.textContent=t.placeholder,y.originalParent=a.parentNode,y.originalNext=a.nextSibling,y.originalParent.insertBefore(y.placeholder,y.originalNext),(l=i.document.createElement("div")).id="__art_dpip_root",i.document.body.appendChild(l);var h=i.document,v=h.createElement("style");if(v.textContent="\n html, body { margin:0; padding:0; width:100%; height:100%; background:#000; overflow:hidden; }\n #__art_dpip_root { position:absolute; inset:0; display:flex; }\n #__art_dpip_root > * { width:100% !important; height:100% !important; }\n ",h.head.appendChild(v),!h.querySelector('meta[name="viewport"]')){var g=h.createElement("meta");g.name="viewport",g.content="width=device-width,initial-scale=1",h.head.appendChild(g)}try{document.querySelectorAll('link[rel="stylesheet"]').forEach(function(e){var t=h.createElement("link");t.rel="stylesheet",t.href=e.href,e.media&&(t.media=e.media),e.crossOrigin&&(t.crossOrigin=e.crossOrigin),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),h.head.appendChild(t)})}catch(e){}try{document.querySelectorAll("style").forEach(function(e){var t=h.createElement("style");t.textContent=e.textContent,h.head.appendChild(t)})}catch(e){}return u=i.document.adoptNode(a),l.appendChild(u),y.currentDoc=i.document,d=function(){var t;return null==(t=e.resize)?void 0:t.call(e)},s=function(){return b()},i.addEventListener("resize",d),i.addEventListener("pagehide",s),i.addEventListener("unload",s),y.cleanup=function(){i.removeEventListener("resize",d),i.removeEventListener("pagehide",s),i.removeEventListener("unload",s)},f(a,"artplayer-document-pip"),null==(n=(o=e.events).bindGlobalEvents)||n.call(o),e.emit("document-pip",!Line truncated
|
||||
!function(e,t){"object"===typeof exports&&"undefined"!==typeof module?module.exports=t():"function"==typeof define&&define.amd?(t.ArtplayerPluginDocumentPip=t(),define(function(){return t.ArtplayerPluginDocumentPip})):(e="undefined"!==typeof globalThis?globalThis:e||self).ArtplayerPluginDocumentPip=t()}(this,function(){"use strict";var e=Object.defineProperty,t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,o=(t,n,i)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i,r=(e,t,n)=>new Promise((i,o)=>{var r=e=>{try{c(n.next(e))}catch(t){o(t)}},l=e=>{try{c(n.throw(e))}catch(t){o(t)}},c=e=>e.done?i(e.value):Promise.resolve(e.value).then(r,l);c((n=n.apply(e,t)).next())});function l(e={}){const l=((e,r)=>{for(var l in r||(r={}))n.call(r,l)&&o(e,l,r[l]);if(t)for(var l of t(r))i.call(r,l)&&o(e,l,r[l]);return e})({width:480,height:270,fallbackToVideoPiP:!0,placeholder:"Playing in Document Picture-in-Picture"},e);return e=>{var t;const n="documentPictureInPicture"in window&&"function"===typeof(null==(t=window.documentPictureInPicture)?void 0:t.requestWindow),{proxy:i,icons:o,i18n:c,template:{$player:d},constructor:{utils:{append:a,tooltip:p,addClass:u,removeClass:s,sleep:m}}}=e,h={win:null,originalParent:null,originalNext:null,currentDoc:null,placeholder:null};function y(){return r(this,null,function*(){var t,i;if(!n&&l.fallbackToVideoPiP)return e.pip=!0,void console.warn("[artplayer-plugin-document-pip] Document Picture-in-Picture is not supported, falling back to Video Picture-in-Picture");if(!h.win)try{const n=yield window.documentPictureInPicture.requestWindow({width:l.width,height:l.height});h.win=n,h.currentDoc=n.document,h.placeholder=document.createElement("div"),h.placeholder.className="artplayer-document-pip-placeholder",h.placeholder.style.cssText="display:flex;justify-content:center;align-items:center;width:100%;height:100%;",h.placeholder.textContent=l.placeholder,h.originalParent=d.parentNode,h.originalNext=d.nextSibling,h.originalParent.insertBefore(h.placeholder,h.originalNext);const o=n.document.createElement("div");o.id="__art_dpip_root",n.document.body.appendChild(o),function(e){const t=e.createElement("style");if(t.textContent="\n html, body { margin:0; padding:0; width:100%; height:100%; background:#000; overflow:hidden; }\n #__art_dpip_root { position:absolute; inset:0; display:flex; }\n #__art_dpip_root > * { width:100% !important; height:100% !important; }\n ",e.head.appendChild(t),!e.querySelector('meta[name="viewport"]')){const t=e.createElement("meta");t.name="viewport",t.content="width=device-width,initial-scale=1",e.head.appendChild(t)}try{document.querySelectorAll('link[rel="stylesheet"]').forEach(t=>{const n=e.createElement("link");n.rel="stylesheet",n.href=t.href,t.media&&(n.media=t.media),t.crossOrigin&&(n.crossOrigin=t.crossOrigin),t.referrerPolicy&&(n.referrerPolicy=t.referrerPolicy),e.head.appendChild(n)})}catch(n){}try{document.querySelectorAll("style").forEach(t=>{const n=e.createElement("style");n.textContent=t.textContent,e.head.appendChild(n)})}catch(n){}}(n.document);const r=n.document.adoptNode(d);o.appendChild(r),h.currentDoc=n.document;const c=()=>{var t;return null==(t=e.resize)?void 0:t.call(e)},a=()=>f();n.addEventListener("resize",c),n.addEventListener("pagehide",a),n.addEventListener("unload",a),h.cleanup=()=>{n.removeEventListener("resize",c),n.removeEventListener("pagehide",a),n.removeEventListener("unload",a)},u(d,"artplayer-document-pip"),null==(i=(t=e.events).bindGlobalEvents)||i.call(t),e.emit("document-pip",!0),yield m(100),e.emit("resize")}catch(o){e.notice.show="Document Picture-in-Picture open failed",console.warn("[artplayer-plugin-document-pip] open failed:",o)}})}function f(){return r(this,null,function*(){var t,n,i;if(h.win)try{null==(t=h.cleanup)||t.call(h),function(){if(!h.placeholder)return;const e=h.placeholder.ownerDocument||document,t=e.adoptNode(d);h.originalParent.insertBefore(t,h.placeholder),h.placeholder.remove(),h.placeholder=null,h.currentDoc=e}(),h.win.close(),h.win=null,s(d,"artplayer-document-pip"),null==(i=(n=e.events).bindGlobalEvents)||i.call(n),e.emit("document-pip",!1),yield m(100),e.emit("resize")}catch(o){e.notice.show="Document Picture-in-Picture close failed",console.warn("[artplayer-plugin-document-pip] close failed:",o)}})}function g(){h.win?f():y()}return e.controls.add({name:"document-pip",position:"right",index:40,tooltip:e.i18n.get("PIP Mode"),mounted:t=>{a(t,o.pip),i(t,"click",g),e.on("document-pip",e=>{p(t,c.get(e?"Exit PIP Mode":"PIP Mode"))})}}),e.on("destroy",f),{name:"artplayerPluginDocumentPip",get isSupported(){return n},get isActive(){return!!h.win},open:y,close:f,toggle:g}}}if("undefined"!==typeof window&&(window.artplayerPluginDocumentPip=l),"undefined"!==typeof document){const e="artplayer-plugin-document-pip";let t=document.getElementById(e);t||(t=document.createElement("style"),t.id=e,"loading"===document.reLine truncated
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-document-pip.js v1.0.2
|
||||
* artplayer-plugin-document-pip.js v1.0.3
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,r,i){var o="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},l="function"==typeof o[r]&&o[r],a=l.i||{},d=l.cache||{},u="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,n){if(!d[t]){if(!e[t]){if(i[t])return i[t];var a="function"==typeof o[r]&&o[r];if(!n&&a)return a(t,!0);if(l)return l(t,!0);if(u&&"string"==typeof t)return u(t);var p=Error("Cannot find module '"+t+"'");throw p.code="MODULE_NOT_FOUND",p}s.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},s.cache={};var f=d[t]=new c.Module(t);e[t][0].call(f.exports,s,f,f.exports,o)}return d[t].exports;function s(e){var t=s.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],i=e[2]||e[0],o=c(r);"*"===t?Object.keys(o).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:function(){return o[e]}})}):"*"===i?Object.defineProperty(n,t,{enumerable:!0,value:o}):Object.defineProperty(n,t,{enumerable:!0,get:function(){return"default"===i?o.__esModule?o.default:o:o[i]}})}),n}return c(t)}}c.isParcelRequire=!0,c.Module=function(e){this.id=e,this.bundle=c,this.require=u,this.exports={}},c.modules=e,c.cache=d,c.parent=l,c.distDir=void 0,c.publicUrl=void 0,c.devServer=void 0,c.i=a,c.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(c,"root",{get:function(){return o[r]}}),o[r]=c;for(var p=0;p<t.length;p++)c(t[p]);if(n){var f=c(n);"object"==typeof exports&&"u">typeof module?module.exports=f:"function"==typeof define&&define.amd&&define(function(){return f})}}({fiyFV:[function(e,t,n,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"default",()=>a);var o=e("bundle-text:./style.less"),l=i.interopDefault(o);function a(e={}){let t={width:480,height:270,fallbackToVideoPiP:!0,placeholder:"Playing in Document Picture-in-Picture",...e};return e=>{let n="documentPictureInPicture"in window&&"function"==typeof window.documentPictureInPicture?.requestWindow,{proxy:r,icons:i,i18n:o,template:{$player:l},constructor:{utils:{append:a,tooltip:d,addClass:u,removeClass:c,sleep:p}}}=e,f={win:null,originalParent:null,originalNext:null,currentDoc:null,placeholder:null};async function s(){if(!n&&t.fallbackToVideoPiP){e.pip=!0,console.warn("[artplayer-plugin-document-pip] Document Picture-in-Picture is not supported, falling back to Video Picture-in-Picture");return}if(!f.win)try{let n=await window.documentPictureInPicture.requestWindow({width:t.width,height:t.height});f.win=n,f.currentDoc=n.document,f.placeholder=document.createElement("div"),f.placeholder.className="artplayer-document-pip-placeholder",f.placeholder.style.cssText="display:flex;justify-content:center;align-items:center;width:100%;height:100%;",f.placeholder.textContent=t.placeholder,f.originalParent=l.parentNode,f.originalNext=l.nextSibling,f.originalParent.insertBefore(f.placeholder,f.originalNext);let i=n.document.createElement("div");i.id="__art_dpip_root",n.document.body.appendChild(i);var r=n.document;let o=r.createElement("style");if(o.textContent=` html, body { margin:0; padding:0; width:100%; height:100%; background:#000; overflow:hidden; } #__art_dpip_root { position:absolute; inset:0; display:flex; } #__art_dpip_root > * { width:100% !important; height:100% !important; } `,r.head.appendChild(o),!r.querySelector('meta[name="viewport"]')){let e=r.createElement("meta");e.name="viewport",e.content="width=device-width,initial-scale=1",r.head.appendChild(e)}try{document.querySelectorAll('link[rel="stylesheet"]').forEach(e=>{let t=r.createElement("link");t.rel="stylesheet",t.href=e.href,e.media&&(t.media=e.media),e.crossOrigin&&(t.crossOrigin=e.crossOrigin),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),r.head.appendChild(t)})}catch{}try{document.querySelectorAll("style").forEach(e=>{let t=r.createElement("style");t.textContent=e.textContent,r.head.appendChild(t)})}catch{}let a=n.document.adoptNode(l);i.appendChild(a),f.currentDoc=n.document;let d=()=>e.resize?.(),c=()=>m();n.addEventListener("resize",d),n.addEventListener("pagehide",c),n.addEventListener("unload",c),f.cleanup=()=>{n.removeEventListener("resize",d),n.removeEventListener("pagehide",c),n.removeEventListener("unload",c)},u(l,"artplayer-document-pip"),e.events.bindGlobalEvents?.(),e.emit("document-pip",!0),await p(100),e.emit("resize")}catch(t){e.notice.show="Document Picture-in-Picture open failed",console.warn("[artplayer-plugin-document-pip] open failed:",t)}}async function m(){if(f.win)try{f.cleanup?.(),function(){if(!f.placeholder)return;let e=f.placeholder.ownerDocument||document,t=e.adoptNode(l);f.originalParent.insertBefore(t,f.placeholder),f.placeholder.remove(),f.placeholder=null,f.currentDoc=e}(),f.win.close(),f.win=null,c(l,"artplayer-document-pip"),e.events.bindGlobalEvents?.(),e.emit("document-pLine truncated
|
||||
function e(e={}){const t={width:480,height:270,fallbackToVideoPiP:!0,placeholder:"Playing in Document Picture-in-Picture",...e};return e=>{const n="documentPictureInPicture"in window&&"function"===typeof window.documentPictureInPicture?.requestWindow,{proxy:i,icons:o,i18n:r,template:{$player:d},constructor:{utils:{append:c,tooltip:l,addClass:a,removeClass:p,sleep:u}}}=e,s={win:null,originalParent:null,originalNext:null,currentDoc:null,placeholder:null};async function m(){if(!n&&t.fallbackToVideoPiP)return e.pip=!0,void console.warn("[artplayer-plugin-document-pip] Document Picture-in-Picture is not supported, falling back to Video Picture-in-Picture");if(!s.win)try{const n=await window.documentPictureInPicture.requestWindow({width:t.width,height:t.height});s.win=n,s.currentDoc=n.document,s.placeholder=document.createElement("div"),s.placeholder.className="artplayer-document-pip-placeholder",s.placeholder.style.cssText="display:flex;justify-content:center;align-items:center;width:100%;height:100%;",s.placeholder.textContent=t.placeholder,s.originalParent=d.parentNode,s.originalNext=d.nextSibling,s.originalParent.insertBefore(s.placeholder,s.originalNext);const i=n.document.createElement("div");i.id="__art_dpip_root",n.document.body.appendChild(i),function(e){const t=e.createElement("style");if(t.textContent="\n html, body { margin:0; padding:0; width:100%; height:100%; background:#000; overflow:hidden; }\n #__art_dpip_root { position:absolute; inset:0; display:flex; }\n #__art_dpip_root > * { width:100% !important; height:100% !important; }\n ",e.head.appendChild(t),!e.querySelector('meta[name="viewport"]')){const t=e.createElement("meta");t.name="viewport",t.content="width=device-width,initial-scale=1",e.head.appendChild(t)}try{document.querySelectorAll('link[rel="stylesheet"]').forEach(t=>{const n=e.createElement("link");n.rel="stylesheet",n.href=t.href,t.media&&(n.media=t.media),t.crossOrigin&&(n.crossOrigin=t.crossOrigin),t.referrerPolicy&&(n.referrerPolicy=t.referrerPolicy),e.head.appendChild(n)})}catch{}try{document.querySelectorAll("style").forEach(t=>{const n=e.createElement("style");n.textContent=t.textContent,e.head.appendChild(n)})}catch{}}(n.document);const o=n.document.adoptNode(d);i.appendChild(o),s.currentDoc=n.document;const r=()=>e.resize?.(),c=()=>h();n.addEventListener("resize",r),n.addEventListener("pagehide",c),n.addEventListener("unload",c),s.cleanup=()=>{n.removeEventListener("resize",r),n.removeEventListener("pagehide",c),n.removeEventListener("unload",c)},a(d,"artplayer-document-pip"),e.events.bindGlobalEvents?.(),e.emit("document-pip",!0),await u(100),e.emit("resize")}catch(i){e.notice.show="Document Picture-in-Picture open failed",console.warn("[artplayer-plugin-document-pip] open failed:",i)}}async function h(){if(s.win)try{s.cleanup?.(),function(){if(!s.placeholder)return;const e=s.placeholder.ownerDocument||document,t=e.adoptNode(d);s.originalParent.insertBefore(t,s.placeholder),s.placeholder.remove(),s.placeholder=null,s.currentDoc=e}(),s.win.close(),s.win=null,p(d,"artplayer-document-pip"),e.events.bindGlobalEvents?.(),e.emit("document-pip",!1),await u(100),e.emit("resize")}catch(t){e.notice.show="Document Picture-in-Picture close failed",console.warn("[artplayer-plugin-document-pip] close failed:",t)}}function y(){s.win?h():m()}return e.controls.add({name:"document-pip",position:"right",index:40,tooltip:e.i18n.get("PIP Mode"),mounted:t=>{c(t,o.pip),i(t,"click",y),e.on("document-pip",e=>{l(t,r.get(e?"Exit PIP Mode":"PIP Mode"))})}}),e.on("destroy",h),{name:"artplayerPluginDocumentPip",get isSupported(){return n},get isActive(){return!!s.win},open:m,close:h,toggle:y}}}if("undefined"!==typeof window&&(window.artplayerPluginDocumentPip=e),"undefined"!==typeof document){const e="artplayer-plugin-document-pip";let t=document.getElementById(e);t||(t=document.createElement("style"),t.id=e,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{document.head.appendChild(t)}):(document.head||document.documentElement).appendChild(t)),t.textContent=".artplayer-document-pip.art-video-player{width:100%!important;height:100%!important}"}export{e as default};
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "artplayer-plugin-document-pip",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"description": "Document PIP plugin for ArtPlayer",
|
||||
"author": "Harvey Zhao <laozhaochaguan@gmail.com>",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import style from 'bundle-text:./style.less'
|
||||
import style from './style.less?inline'
|
||||
|
||||
export default function artplayerPluginDocumentPip(userOptions = {}) {
|
||||
const options = {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-hls-control.js v1.0.1
|
||||
* artplayer-plugin-hls-control.js v1.0.2
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,o,n,r){var l="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},u="function"==typeof l[n]&&l[n],i=u.i||{},a=u.cache||{},c="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function s(t,o){if(!a[t]){if(!e[t]){if(r[t])return r[t];var i="function"==typeof l[n]&&l[n];if(!o&&i)return i(t,!0);if(u)return u(t,!0);if(c&&"string"==typeof t)return c(t);var f=Error("Cannot find module '"+t+"'");throw f.code="MODULE_NOT_FOUND",f}p.resolve=function(o){var n=e[t][1][o];return null!=n?n:o},p.cache={};var d=a[t]=new s.Module(t);e[t][0].call(d.exports,p,d,d.exports,l)}return a[t].exports;function p(e){var t=p.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],l=s(n);"*"===t?Object.keys(l).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(o,e)||Object.defineProperty(o,e,{enumerable:!0,get:function(){return l[e]}})}):"*"===r?Object.defineProperty(o,t,{enumerable:!0,value:l}):Object.defineProperty(o,t,{enumerable:!0,get:function(){return"default"===r?l.__esModule?l.default:l:l[r]}})}),o}return s(t)}}s.isParcelRequire=!0,s.Module=function(e){this.id=e,this.bundle=s,this.require=c,this.exports={}},s.modules=e,s.cache=a,s.parent=u,s.distDir=void 0,s.publicUrl=void 0,s.devServer=void 0,s.i=i,s.register=function(t,o){e[t]=[function(e,t){t.exports=o},{}]},Object.defineProperty(s,"root",{get:function(){return l[n]}}),l[n]=s;for(var f=0;f<t.length;f++)s(t[f]);if(o){var d=s(o);"object"==typeof exports&&"u">typeof module?module.exports=d:"function"==typeof define&&define.amd&&define(function(){return d})}}({dHVos:[function(e,t,o,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(o),r.export(o,"default",()=>s);var l=e("bundle-text:./audio.svg"),u=r.interopDefault(l),i=e("bundle-text:./quality.svg"),a=r.interopDefault(i);function c(e,t){let o=new Map;return e.filter(e=>{let n=e[t];return void 0===n||!o.has(n)&&o.set(n,1)})}function s(e={}){return t=>{let{$video:o}=t.template,{errorHandle:n}=t.constructor.utils;function r(){n(t.hls?.media===o,'Cannot find instance of HLS from "art.hls"'),function(o){if(!o.levels.length)return;let n=e.quality||{},r=n.auto||"Auto",l=n.title||"Quality",u=n.getName||(e=>e.name||`${e.height}P`),i=o.levels[o.currentLevel],s=i?u(i):r,f=c(o.levels.map((e,t)=>({html:u(e,t),value:t,default:o.currentLevel===t})),"html").sort((e,t)=>t.value-e.value);f.push({html:r,value:-1,default:-1===o.currentLevel});let d=e=>(o.currentLevel=e.value,t.notice.show=`${l}: ${e.html}`,n.control&&t.controls.check(e),n.setting&&t.setting.check(e),e.html);n.control&&t.controls.update({name:"hls-quality",position:"right",html:s,style:{padding:"0 10px"},selector:f,onSelect:d}),n.setting&&t.setting.update({name:"hls-quality",tooltip:s,html:l,icon:a.default,width:200,selector:f,onSelect:d})}(t.hls),function(o){if(!o.audioTracks.length)return;let n=e.audio||{},r=n.auto||"Auto",l=n.title||"Audio",i=n.getName||(e=>e.name||e.lang||e.language),a=o.audioTracks[o.audioTrack],s=a?i(a):r,f=c(o.audioTracks.map((e,t)=>({html:i(e,t),value:e.id,default:o.audioTrack===e.id})),"html"),d=e=>(o.audioTrack=e.value,t.notice.show=`${l}: ${e.html}`,n.control&&t.controls.check(e),n.setting&&t.setting.check(e),e.html);n.control&&t.controls.update({name:"hls-audio",position:"right",html:s,style:{padding:"0 10px"},selector:f,onSelect:d}),n.setting&&t.setting.update({name:"hls-audio",tooltip:s,html:l,icon:u.default,width:200,selector:f,onSelect:d})}(t.hls)}return t.on("ready",r),t.on("restart",r),{name:"artplayerPluginHlsControl",update:r}}}"u">typeof window&&(window.artplayerPluginHlsControl=s)},{"bundle-text:./audio.svg":"fVNuY","bundle-text:./quality.svg":"5ZFEa","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],fVNuY:[function(e,t,o,n){t.exports='<svg xmlns="http://www.w3.org/2000/svg" height="18" viewBox="0 0 512 512"><path fill="#fff" d="M256 80C149.9 80 62.4 159.4 49.6 262c9.4-3.8 19.6-6 30.4-6 26.5 0 48 21.5 48 48v128c0 26.5-21.5 48-48 48-44.2 0-80-35.8-80-80V288C0 146.6 114.6 32 256 32s256 114.6 256 256v112c0 44.2-35.8 80-80 80-26.5 0-48-21.5-48-48V304c0-26.5 21.5-48 48-48 10.8 0 21 2.1 30.4 6C449.6 159.4 362.1 80 256 80"/></svg>'},{}],"5ZFEa":[function(e,t,o,n){t.exports='<svg xmlns="http://www.w3.org/2000/svg" height="18" viewBox="0 0 512 512"><path fill="#fff" d="M0 96c0-35.3 28.7-64 64-64h384c35.3 0 64 28.7 64 64v320c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64Zm323.8 106.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6-26.5-33.1c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4S78.8 416 88 416h336c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7ZM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96"/></svg>'},{}],"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",{vaLine truncated
|
||||
!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.ArtplayerPluginHlsControl=e(),define(function(){return t.ArtplayerPluginHlsControl})):(t="undefined"!==typeof globalThis?globalThis:t||self).ArtplayerPluginHlsControl=e()}(this,function(){"use strict";function t(t,e){const l=new Map;return t.filter(t=>{const n=t[e];return void 0===n||!l.has(n)&&l.set(n,1)})}function e(e={}){return l=>{const{$video:n}=l.template,{errorHandle:o}=l.constructor.utils;function i(){o(l.hls?.media===n,'Cannot find instance of HLS from "art.hls"'),function(n){if(!n.levels.length)return;const o=e.quality||{},i=o.auto||"Auto",s=o.title||"Quality",a=o.getName||(t=>t.name||`${t.height}P`),c=n.levels[n.currentLevel],r=c?a(c):i,u=t(n.levels.map((t,e)=>({html:a(t,e),value:e,default:n.currentLevel===e})),"html").sort((t,e)=>e.value-t.value);u.push({html:i,value:-1,default:-1===n.currentLevel});const d=t=>(n.currentLevel=t.value,l.notice.show=`${s}: ${t.html}`,o.control&&l.controls.check(t),o.setting&&l.setting.check(t),t.html);o.control&&l.controls.update({name:"hls-quality",position:"right",html:r,style:{padding:"0 10px"},selector:u,onSelect:d}),o.setting&&l.setting.update({name:"hls-quality",tooltip:r,html:s,icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" height="18"><path fill="#fff" d="M0 96C0 60.7 28.7 32 64 32l384 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6l96 0 32 0 208 0c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"/></svg>',width:200,selector:u,onSelect:d})}(l.hls),function(n){if(!n.audioTracks.length)return;const o=e.audio||{},i=o.auto||"Auto",s=o.title||"Audio",a=o.getName||(t=>t.name||t.lang||t.language),c=n.audioTracks[n.audioTrack],r=c?a(c):i,u=t(n.audioTracks.map((t,e)=>({html:a(t,e),value:t.id,default:n.audioTrack===t.id})),"html"),d=t=>(n.audioTrack=t.value,l.notice.show=`${s}: ${t.html}`,o.control&&l.controls.check(t),o.setting&&l.setting.check(t),t.html);o.control&&l.controls.update({name:"hls-audio",position:"right",html:r,style:{padding:"0 10px"},selector:u,onSelect:d}),o.setting&&l.setting.update({name:"hls-audio",tooltip:r,html:s,icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" height="18"><path fill="#fff" d="M256 80C149.9 80 62.4 159.4 49.6 262c9.4-3.8 19.6-6 30.4-6c26.5 0 48 21.5 48 48l0 128c0 26.5-21.5 48-48 48c-44.2 0-80-35.8-80-80l0-16 0-48 0-48C0 146.6 114.6 32 256 32s256 114.6 256 256l0 48 0 48 0 16c0 44.2-35.8 80-80 80c-26.5 0-48-21.5-48-48l0-128c0-26.5 21.5-48 48-48c10.8 0 21 2.1 30.4 6C449.6 159.4 362.1 80 256 80z"/></svg>',width:200,selector:u,onSelect:d})}(l.hls)}return l.on("ready",i),l.on("restart",i),{name:"artplayerPluginHlsControl",update:i}}}return"undefined"!==typeof window&&(window.artplayerPluginHlsControl=e),e});
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-hls-control.js v1.0.1
|
||||
* artplayer-plugin-hls-control.js v1.0.2
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,o,r){var u="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},l="function"==typeof u[o]&&u[o],i=l.i||{},a=l.cache||{},c="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,n){if(!a[t]){if(!e[t]){if(r[t])return r[t];var i="function"==typeof u[o]&&u[o];if(!n&&i)return i(t,!0);if(l)return l(t,!0);if(c&&"string"==typeof t)return c(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}p.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},p.cache={};var d=a[t]=new f.Module(t);e[t][0].call(d.exports,p,d,d.exports,u)}return a[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],o=e[1],r=e[2]||e[0],u=f(o);"*"===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]}})}):"*"===r?Object.defineProperty(n,t,{enumerable:!0,value:u}):Object.defineProperty(n,t,{enumerable:!0,get:function(){return"default"===r?u.__esModule?u.default:u:u[r]}})}),n}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=a,f.parent=l,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=i,f.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(f,"root",{get:function(){return u[o]}}),u[o]=f;for(var s=0;s<t.length;s++)f(t[s]);if(n){var d=f(n);"object"==typeof exports&&"u">typeof module?module.exports=d:"function"==typeof define&&define.amd&&define(function(){return d})}}({do1Zn:[function(e,t,n,o){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(n),r.export(n,"default",function(){return f});var u=e("bundle-text:./audio.svg"),l=r.interopDefault(u),i=e("bundle-text:./quality.svg"),a=r.interopDefault(i);function c(e,t){var n=new Map;return e.filter(function(e){var o=e[t];return void 0===o||!n.has(o)&&n.set(o,1)})}function f(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t){var n=t.template.$video,o=t.constructor.utils.errorHandle;function r(){var r;o((null==(r=t.hls)?void 0:r.media)===n,'Cannot find instance of HLS from "art.hls"'),function(n){if(n.levels.length){var o=e.quality||{},r=o.auto||"Auto",u=o.title||"Quality",l=o.getName||function(e){return e.name||"".concat(e.height,"P")},i=n.levels[n.currentLevel],f=i?l(i):r,s=c(n.levels.map(function(e,t){return{html:l(e,t),value:t,default:n.currentLevel===t}}),"html").sort(function(e,t){return t.value-e.value});s.push({html:r,value:-1,default:-1===n.currentLevel});var d=function(e){return n.currentLevel=e.value,t.notice.show="".concat(u,": ").concat(e.html),o.control&&t.controls.check(e),o.setting&&t.setting.check(e),e.html};o.control&&t.controls.update({name:"hls-quality",position:"right",html:f,style:{padding:"0 10px"},selector:s,onSelect:d}),o.setting&&t.setting.update({name:"hls-quality",tooltip:f,html:u,icon:a.default,width:200,selector:s,onSelect:d})}}(t.hls),function(n){if(n.audioTracks.length){var o=e.audio||{},r=o.auto||"Auto",u=o.title||"Audio",i=o.getName||function(e){return e.name||e.lang||e.language},a=n.audioTracks[n.audioTrack],f=a?i(a):r,s=c(n.audioTracks.map(function(e,t){return{html:i(e,t),value:e.id,default:n.audioTrack===e.id}}),"html"),d=function(e){return n.audioTrack=e.value,t.notice.show="".concat(u,": ").concat(e.html),o.control&&t.controls.check(e),o.setting&&t.setting.check(e),e.html};o.control&&t.controls.update({name:"hls-audio",position:"right",html:f,style:{padding:"0 10px"},selector:s,onSelect:d}),o.setting&&t.setting.update({name:"hls-audio",tooltip:f,html:u,icon:l.default,width:200,selector:s,onSelect:d})}}(t.hls)}return t.on("ready",r),t.on("restart",r),{name:"artplayerPluginHlsControl",update:r}}}"u">typeof window&&(window.artplayerPluginHlsControl=f)},{"bundle-text:./audio.svg":"3PyT9","bundle-text:./quality.svg":"6NhUQ","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],"3PyT9":[function(e,t,n,o){t.exports='<svg xmlns="http://www.w3.org/2000/svg" height="18" viewBox="0 0 512 512"><path fill="#fff" d="M256 80C149.9 80 62.4 159.4 49.6 262c9.4-3.8 19.6-6 30.4-6 26.5 0 48 21.5 48 48v128c0 26.5-21.5 48-48 48-44.2 0-80-35.8-80-80V288C0 146.6 114.6 32 256 32s256 114.6 256 256v112c0 44.2-35.8 80-80 80-26.5 0-48-21.5-48-48V304c0-26.5 21.5-48 48-48 10.8 0 21 2.1 30.4 6C449.6 159.4 362.1 80 256 80"/></svg>'},{}],"6NhUQ":[function(e,t,n,o){t.exports='<svg xmlns="http://www.w3.org/2000/svg" height="18" viewBox="0 0 512 512"><path fill="#fff" d="M0 96c0-35.3 28.7-64 64-64h384c35.3 0 64 28.7 64 64v320c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64Zm323.8 106.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6-26.5-33.1c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4S78.8 416 88 416h336c8.9 0 17.1-4.9 21.2-12.8sLine truncated
|
||||
!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.ArtplayerPluginHlsControl=e(),define(function(){return t.ArtplayerPluginHlsControl})):(t="undefined"!==typeof globalThis?globalThis:t||self).ArtplayerPluginHlsControl=e()}(this,function(){"use strict";function t(t,e){const l=new Map;return t.filter(t=>{const n=t[e];return void 0===n||!l.has(n)&&l.set(n,1)})}function e(e={}){return l=>{const{$video:n}=l.template,{errorHandle:o}=l.constructor.utils;function i(){var i;o((null==(i=l.hls)?void 0:i.media)===n,'Cannot find instance of HLS from "art.hls"'),function(n){if(!n.levels.length)return;const o=e.quality||{},i=o.auto||"Auto",a=o.title||"Quality",s=o.getName||(t=>t.name||`${t.height}P`),c=n.levels[n.currentLevel],r=c?s(c):i,u=t(n.levels.map((t,e)=>({html:s(t,e),value:e,default:n.currentLevel===e})),"html").sort((t,e)=>e.value-t.value);u.push({html:i,value:-1,default:-1===n.currentLevel});const d=t=>(n.currentLevel=t.value,l.notice.show=`${a}: ${t.html}`,o.control&&l.controls.check(t),o.setting&&l.setting.check(t),t.html);o.control&&l.controls.update({name:"hls-quality",position:"right",html:r,style:{padding:"0 10px"},selector:u,onSelect:d}),o.setting&&l.setting.update({name:"hls-quality",tooltip:r,html:a,icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" height="18"><path fill="#fff" d="M0 96C0 60.7 28.7 32 64 32l384 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6l96 0 32 0 208 0c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"/></svg>',width:200,selector:u,onSelect:d})}(l.hls),function(n){if(!n.audioTracks.length)return;const o=e.audio||{},i=o.auto||"Auto",a=o.title||"Audio",s=o.getName||(t=>t.name||t.lang||t.language),c=n.audioTracks[n.audioTrack],r=c?s(c):i,u=t(n.audioTracks.map((t,e)=>({html:s(t,e),value:t.id,default:n.audioTrack===t.id})),"html"),d=t=>(n.audioTrack=t.value,l.notice.show=`${a}: ${t.html}`,o.control&&l.controls.check(t),o.setting&&l.setting.check(t),t.html);o.control&&l.controls.update({name:"hls-audio",position:"right",html:r,style:{padding:"0 10px"},selector:u,onSelect:d}),o.setting&&l.setting.update({name:"hls-audio",tooltip:r,html:a,icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" height="18"><path fill="#fff" d="M256 80C149.9 80 62.4 159.4 49.6 262c9.4-3.8 19.6-6 30.4-6c26.5 0 48 21.5 48 48l0 128c0 26.5-21.5 48-48 48c-44.2 0-80-35.8-80-80l0-16 0-48 0-48C0 146.6 114.6 32 256 32s256 114.6 256 256l0 48 0 48 0 16c0 44.2-35.8 80-80 80c-26.5 0-48-21.5-48-48l0-128c0-26.5 21.5-48 48-48c10.8 0 21 2.1 30.4 6C449.6 159.4 362.1 80 256 80z"/></svg>',width:200,selector:u,onSelect:d})}(l.hls)}return l.on("ready",i),l.on("restart",i),{name:"artplayerPluginHlsControl",update:i}}}return"undefined"!==typeof window&&(window.artplayerPluginHlsControl=e),e});
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-hls-control.js v1.0.1
|
||||
* artplayer-plugin-hls-control.js v1.0.2
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,o,n){var l="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},u="function"==typeof l[o]&&l[o],i=u.i||{},a=u.cache||{},c="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,r){if(!a[t]){if(!e[t]){if(n[t])return n[t];var i="function"==typeof l[o]&&l[o];if(!r&&i)return i(t,!0);if(u)return u(t,!0);if(c&&"string"==typeof t)return c(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}p.resolve=function(r){var o=e[t][1][r];return null!=o?o:r},p.cache={};var d=a[t]=new f.Module(t);e[t][0].call(d.exports,p,d,d.exports,l)}return a[t].exports;function p(e){var t=p.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],l=f(o);"*"===t?Object.keys(l).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return l[e]}})}):"*"===n?Object.defineProperty(r,t,{enumerable:!0,value:l}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===n?l.__esModule?l.default:l:l[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=a,f.parent=u,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=i,f.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(f,"root",{get:function(){return l[o]}}),l[o]=f;for(var s=0;s<t.length;s++)f(t[s]);if(r){var d=f(r);"object"==typeof exports&&"u">typeof module?module.exports=d:"function"==typeof define&&define.amd&&define(function(){return d})}}({"7qxYx":[function(e,t,r,o){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",()=>f);var l=e("bundle-text:./audio.svg"),u=n.interopDefault(l),i=e("bundle-text:./quality.svg"),a=n.interopDefault(i);function c(e,t){let r=new Map;return e.filter(e=>{let o=e[t];return void 0===o||!r.has(o)&&r.set(o,1)})}function f(e={}){return t=>{let{$video:r}=t.template,{errorHandle:o}=t.constructor.utils;function n(){o(t.hls?.media===r,'Cannot find instance of HLS from "art.hls"'),function(r){if(!r.levels.length)return;let o=e.quality||{},n=o.auto||"Auto",l=o.title||"Quality",u=o.getName||(e=>e.name||`${e.height}P`),i=r.levels[r.currentLevel],f=i?u(i):n,s=c(r.levels.map((e,t)=>({html:u(e,t),value:t,default:r.currentLevel===t})),"html").sort((e,t)=>t.value-e.value);s.push({html:n,value:-1,default:-1===r.currentLevel});let d=e=>(r.currentLevel=e.value,t.notice.show=`${l}: ${e.html}`,o.control&&t.controls.check(e),o.setting&&t.setting.check(e),e.html);o.control&&t.controls.update({name:"hls-quality",position:"right",html:f,style:{padding:"0 10px"},selector:s,onSelect:d}),o.setting&&t.setting.update({name:"hls-quality",tooltip:f,html:l,icon:a.default,width:200,selector:s,onSelect:d})}(t.hls),function(r){if(!r.audioTracks.length)return;let o=e.audio||{},n=o.auto||"Auto",l=o.title||"Audio",i=o.getName||(e=>e.name||e.lang||e.language),a=r.audioTracks[r.audioTrack],f=a?i(a):n,s=c(r.audioTracks.map((e,t)=>({html:i(e,t),value:e.id,default:r.audioTrack===e.id})),"html"),d=e=>(r.audioTrack=e.value,t.notice.show=`${l}: ${e.html}`,o.control&&t.controls.check(e),o.setting&&t.setting.check(e),e.html);o.control&&t.controls.update({name:"hls-audio",position:"right",html:f,style:{padding:"0 10px"},selector:s,onSelect:d}),o.setting&&t.setting.update({name:"hls-audio",tooltip:f,html:l,icon:u.default,width:200,selector:s,onSelect:d})}(t.hls)}return t.on("ready",n),t.on("restart",n),{name:"artplayerPluginHlsControl",update:n}}}"u">typeof window&&(window.artplayerPluginHlsControl=f)},{"bundle-text:./audio.svg":"jEE7y","bundle-text:./quality.svg":"8KB1y","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],jEE7y:[function(e,t,r,o){t.exports='<svg xmlns="http://www.w3.org/2000/svg" height="18" viewBox="0 0 512 512"><path fill="#fff" d="M256 80C149.9 80 62.4 159.4 49.6 262c9.4-3.8 19.6-6 30.4-6 26.5 0 48 21.5 48 48v128c0 26.5-21.5 48-48 48-44.2 0-80-35.8-80-80V288C0 146.6 114.6 32 256 32s256 114.6 256 256v112c0 44.2-35.8 80-80 80-26.5 0-48-21.5-48-48V304c0-26.5 21.5-48 48-48 10.8 0 21 2.1 30.4 6C449.6 159.4 362.1 80 256 80"/></svg>'},{}],"8KB1y":[function(e,t,r,o){t.exports='<svg xmlns="http://www.w3.org/2000/svg" height="18" viewBox="0 0 512 512"><path fill="#fff" d="M0 96c0-35.3 28.7-64 64-64h384c35.3 0 64 28.7 64 64v320c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64Zm323.8 106.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6-26.5-33.1c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4S78.8 416 88 416h336c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7ZM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96"/></svg>'},{}],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",{vaLine truncated
|
||||
function t(t,e){const l=/* @__PURE__ */new Map;return t.filter(t=>{const o=t[e];return void 0===o||!l.has(o)&&l.set(o,1)})}function e(e={}){return l=>{const{$video:o}=l.template,{errorHandle:n}=l.constructor.utils;function a(){n(l.hls?.media===o,'Cannot find instance of HLS from "art.hls"'),function(o){if(!o.levels.length)return;const n=e.quality||{},a=n.auto||"Auto",i=n.title||"Quality",c=n.getName||(t=>t.name||`${t.height}P`),s=o.levels[o.currentLevel],r=s?c(s):a,u=t(o.levels.map((t,e)=>({html:c(t,e),value:e,default:o.currentLevel===e})),"html").sort((t,e)=>e.value-t.value);u.push({html:a,value:-1,default:-1===o.currentLevel});const h=t=>(o.currentLevel=t.value,l.notice.show=`${i}: ${t.html}`,n.control&&l.controls.check(t),n.setting&&l.setting.check(t),t.html);n.control&&l.controls.update({name:"hls-quality",position:"right",html:r,style:{padding:"0 10px"},selector:u,onSelect:h}),n.setting&&l.setting.update({name:"hls-quality",tooltip:r,html:i,icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" height="18"><path fill="#fff" d="M0 96C0 60.7 28.7 32 64 32l384 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6l96 0 32 0 208 0c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"/></svg>',width:200,selector:u,onSelect:h})}(l.hls),function(o){if(!o.audioTracks.length)return;const n=e.audio||{},a=n.auto||"Auto",i=n.title||"Audio",c=n.getName||(t=>t.name||t.lang||t.language),s=o.audioTracks[o.audioTrack],r=s?c(s):a,u=t(o.audioTracks.map((t,e)=>({html:c(t,e),value:t.id,default:o.audioTrack===t.id})),"html"),h=t=>(o.audioTrack=t.value,l.notice.show=`${i}: ${t.html}`,n.control&&l.controls.check(t),n.setting&&l.setting.check(t),t.html);n.control&&l.controls.update({name:"hls-audio",position:"right",html:r,style:{padding:"0 10px"},selector:u,onSelect:h}),n.setting&&l.setting.update({name:"hls-audio",tooltip:r,html:i,icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" height="18"><path fill="#fff" d="M256 80C149.9 80 62.4 159.4 49.6 262c9.4-3.8 19.6-6 30.4-6c26.5 0 48 21.5 48 48l0 128c0 26.5-21.5 48-48 48c-44.2 0-80-35.8-80-80l0-16 0-48 0-48C0 146.6 114.6 32 256 32s256 114.6 256 256l0 48 0 48 0 16c0 44.2-35.8 80-80 80c-26.5 0-48-21.5-48-48l0-128c0-26.5 21.5-48 48-48c10.8 0 21 2.1 30.4 6C449.6 159.4 362.1 80 256 80z"/></svg>',width:200,selector:u,onSelect:h})}(l.hls)}return l.on("ready",a),l.on("restart",a),{name:"artplayerPluginHlsControl",update:a}}}"undefined"!==typeof window&&(window.artplayerPluginHlsControl=e);export{e as default};
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "artplayer-plugin-hls-control",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"description": "Hls control plugin for ArtPlayer",
|
||||
"author": "Harvey Zhao <laozhaochaguan@gmail.com>",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import $audio from 'bundle-text:./audio.svg'
|
||||
import $quality from 'bundle-text:./quality.svg'
|
||||
import $audio from './audio.svg?raw'
|
||||
import $quality from './quality.svg?raw'
|
||||
|
||||
function uniqBy(array, property) {
|
||||
const seen = new Map()
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-iframe.js v1.0.0
|
||||
* artplayer-plugin-iframe.js v1.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,o,n){var s="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},i="function"==typeof s[o]&&s[o],a=i.i||{},u=i.cache||{},f="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function l(t,r){if(!u[t]){if(!e[t]){if(n[t])return n[t];var a="function"==typeof s[o]&&s[o];if(!r&&a)return a(t,!0);if(i)return i(t,!0);if(f&&"string"==typeof t)return f(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){var o=e[t][1][r];return null!=o?o:r},p.cache={};var d=u[t]=new l.Module(t);e[t][0].call(d.exports,p,d,d.exports,s)}return u[t].exports;function p(e){var t=p.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],s=l(o);"*"===t?Object.keys(s).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return s[e]}})}):"*"===n?Object.defineProperty(r,t,{enumerable:!0,value:s}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===n?s.__esModule?s.default:s:s[n]}})}),r}return l(t)}}l.isParcelRequire=!0,l.Module=function(e){this.id=e,this.bundle=l,this.require=f,this.exports={}},l.modules=e,l.cache=u,l.parent=i,l.distDir=void 0,l.publicUrl=void 0,l.devServer=void 0,l.i=a,l.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(l,"root",{get:function(){return s[o]}}),s[o]=l;for(var c=0;c<t.length;c++)l(t[c]);if(r){var d=l(r);"object"==typeof exports&&"u">typeof module?module.exports=d:"function"==typeof define&&define.amd&&define(function(){return d})}}({jSFRI:[function(e,t,r,o){e("@parcel/transformer-js/src/esmodule-helpers.js").defineInteropFlag(r);class n{static get iframe(){return window.top!==window}static postMessage({type:e,data:t,id:r=0}){if(!n.iframe)throw Error('The "ArtplayerPluginIframe.postMessage" method can only be used in iframe');window.parent.postMessage({type:e,data:t,id:r},"*")}static async onMessage(e){if(!n.iframe)throw Error('The "ArtplayerPluginIframe.onMessage" method can only be used in iframe');let{type:t,data:r,id:o}=e.data;if("commit"===t)try{if(r.match(/\bresolve\((.*?)\)/)){let e=`return new Promise(function(resolve){ ${r} })`,t=await Function(e)();n.postMessage({type:"response",data:t,id:o})}else{let e=Function(r)();n.postMessage({type:"response",data:e,id:o})}}catch(e){throw n.postMessage({type:"error",data:e.message,id:o}),e}}static inject(){if(!n.iframe)throw Error('The "ArtplayerPluginIframe.inject" method can only be used in iframe');n.postMessage({type:"inject"}),window.addEventListener("message",n.onMessage)}constructor({iframe:e,url:t}){if(e instanceof HTMLIFrameElement==!1)throw TypeError('"option.iframe" needs to be a HTMLIFrameElement');if("string"!=typeof t)throw TypeError('"option.url" needs to be a string');this.url=t,this.$iframe=e,this.promises={},this.injected=!1,this.destroyed=!1,this.messageCallback=()=>null,this.onMessage=this.onMessage.bind(this),window.addEventListener("message",this.onMessage),this.$iframe.src=this.url}onMessage(e){let{type:t,data:r,id:o}=e.data;"inject"===t&&(this.injected=!0),this.promises[o]&&("error"===t?this.promises[o].reject(Error(r)):this.promises[o].resove(r),delete this.promises[o]),this.messageCallback&&this.messageCallback({type:t,data:r})}postMessage({type:e,data:t}){return new Promise((r,o)=>{(function n(){if(this.destroyed)o(Error("The instance has been destroyed"));else if(this.injected){let n=Date.now();this.promises[n]={resove:r,reject:o},this.$iframe.contentWindow.postMessage({type:e,data:t,id:n},"*")}else setTimeout(n.bind(this),200)}).call(this)})}commit(e){if("function"!=typeof e)throw TypeError('"commit.callback" needs to be a function');let t=e.toString(),r=t.substring(t.indexOf("{")+1,t.lastIndexOf("}"));return this.postMessage({type:"commit",data:r})}message(e){if("function"!=typeof e)throw TypeError('"message.callback" needs to be a function');this.messageCallback=e}destroy(){this.destroyed=!0,window.removeEventListener("message",this.onMessage)}}r.default=n,"u">typeof window&&(window.ArtplayerPluginIframe=n)},{"@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})}},{}]},["jSFRI"],"jSFRI","parcelRequire4dc0",{});
|
||||
!function(e,t){"object"===typeof exports&&"undefined"!==typeof module?module.exports=t():"function"==typeof define&&define.amd?(t.ArtplayerPluginIframe=t(),define(function(){return t.ArtplayerPluginIframe})):(e="undefined"!==typeof globalThis?globalThis:e||self).ArtplayerPluginIframe=t()}(this,function(){"use strict";class e{static get iframe(){return window.top!==window}static postMessage({type:t,data:s,id:i=0}){if(!e.iframe)throw new Error('The "ArtplayerPluginIframe.postMessage" method can only be used in iframe');window.parent.postMessage({type:t,data:s,id:i},"*")}static async onMessage(t){if(!e.iframe)throw new Error('The "ArtplayerPluginIframe.onMessage" method can only be used in iframe');const{type:s,data:i,id:n}=t.data;if("commit"===s)try{if(i.match(/\bresolve\((.*?)\)/)){const t=`return new Promise(function(resolve){\n${i}\n})`,s=await new Function(t)();e.postMessage({type:"response",data:s,id:n})}else{const t=new Function(i)();e.postMessage({type:"response",data:t,id:n})}}catch(o){throw e.postMessage({type:"error",data:o.message,id:n}),o}}static inject(){if(!e.iframe)throw new Error('The "ArtplayerPluginIframe.inject" method can only be used in iframe');e.postMessage({type:"inject"}),window.addEventListener("message",e.onMessage)}constructor({iframe:e,url:t}){if(e instanceof HTMLIFrameElement===!1)throw new TypeError('"option.iframe" needs to be a HTMLIFrameElement');if("string"!==typeof t)throw new TypeError('"option.url" needs to be a string');this.url=t,this.$iframe=e,this.promises={},this.injected=!1,this.destroyed=!1,this.messageCallback=()=>null,this.onMessage=this.onMessage.bind(this),window.addEventListener("message",this.onMessage),this.$iframe.src=this.url}onMessage(e){const{type:t,data:s,id:i}=e.data;if("inject"===t)this.injected=!0;this.promises[i]&&("error"===t?this.promises[i].reject(new Error(s)):this.promises[i].resove(s),delete this.promises[i]),this.messageCallback&&this.messageCallback({type:t,data:s})}postMessage({type:e,data:t}){return new Promise((s,i)=>{(function n(){if(this.destroyed)i(new Error("The instance has been destroyed"));else if(this.injected){const n=Date.now();this.promises[n]={resove:s,reject:i},this.$iframe.contentWindow.postMessage({type:e,data:t,id:n},"*")}else setTimeout(n.bind(this),200)}).call(this)})}commit(e){if("function"!==typeof e)throw new TypeError('"commit.callback" needs to be a function');const t=e.toString(),s=t.substring(t.indexOf("{")+1,t.lastIndexOf("}"));return this.postMessage({type:"commit",data:s})}message(e){if("function"!==typeof e)throw new TypeError('"message.callback" needs to be a function');this.messageCallback=e}destroy(){this.destroyed=!0,window.removeEventListener("message",this.onMessage)}}return"undefined"!==typeof window&&(window.ArtplayerPluginIframe=e),e});
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-iframe.js v1.0.0
|
||||
* artplayer-plugin-iframe.js v1.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,n,o){var s="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},i="function"==typeof s[n]&&s[n],a=i.i||{},c=i.cache||{},u="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function l(t,r){if(!c[t]){if(!e[t]){if(o[t])return o[t];var a="function"==typeof s[n]&&s[n];if(!r&&a)return a(t,!0);if(i)return i(t,!0);if(u&&"string"==typeof t)return u(t);var f=Error("Cannot find module '"+t+"'");throw f.code="MODULE_NOT_FOUND",f}d.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},d.cache={};var p=c[t]=new l.Module(t);e[t][0].call(p.exports,d,p,p.exports,s)}return c[t].exports;function d(e){var t=d.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],s=l(n);"*"===t?Object.keys(s).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return s[e]}})}):"*"===o?Object.defineProperty(r,t,{enumerable:!0,value:s}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===o?s.__esModule?s.default:s:s[o]}})}),r}return l(t)}}l.isParcelRequire=!0,l.Module=function(e){this.id=e,this.bundle=l,this.require=u,this.exports={}},l.modules=e,l.cache=c,l.parent=i,l.distDir=void 0,l.publicUrl=void 0,l.devServer=void 0,l.i=a,l.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(l,"root",{get:function(){return s[n]}}),s[n]=l;for(var f=0;f<t.length;f++)l(t[f]);if(r){var p=l(r);"object"==typeof exports&&"u">typeof module?module.exports=p:"function"==typeof define&&define.amd&&define(function(){return p})}}({"8IkGp":[function(e,t,r,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"default",function(){return u});var s=e("@swc/helpers/cjs/_async_to_generator.cjs"),i=e("@swc/helpers/cjs/_class_call_check.cjs"),a=e("@swc/helpers/cjs/_create_class.cjs"),c=e("@swc/helpers/cjs/_ts_generator.cjs"),u=function(){"use strict";function e(t){var r=t.iframe,n=t.url;if((0,i._)(this,e),r instanceof HTMLIFrameElement==!1)throw TypeError('"option.iframe" needs to be a HTMLIFrameElement');if("string"!=typeof n)throw TypeError('"option.url" needs to be a string');this.url=n,this.$iframe=r,this.promises={},this.injected=!1,this.destroyed=!1,this.messageCallback=function(){return null},this.onMessage=this.onMessage.bind(this),window.addEventListener("message",this.onMessage),this.$iframe.src=this.url}return(0,a._)(e,[{key:"onMessage",value:function(e){var t=e.data,r=t.type,n=t.data,o=t.id;"inject"===r&&(this.injected=!0),this.promises[o]&&("error"===r?this.promises[o].reject(Error(n)):this.promises[o].resove(n),delete this.promises[o]),this.messageCallback&&this.messageCallback({type:r,data:n})}},{key:"postMessage",value:function(e){var t=this,r=e.type,n=e.data;return new Promise(function(e,o){(function t(){if(this.destroyed)o(Error("The instance has been destroyed"));else if(this.injected){var s=Date.now();this.promises[s]={resove:e,reject:o},this.$iframe.contentWindow.postMessage({type:r,data:n,id:s},"*")}else setTimeout(t.bind(this),200)}).call(t)})}},{key:"commit",value:function(e){if("function"!=typeof e)throw TypeError('"commit.callback" needs to be a function');var t=e.toString(),r=t.substring(t.indexOf("{")+1,t.lastIndexOf("}"));return this.postMessage({type:"commit",data:r})}},{key:"message",value:function(e){if("function"!=typeof e)throw TypeError('"message.callback" needs to be a function');this.messageCallback=e}},{key:"destroy",value:function(){this.destroyed=!0,window.removeEventListener("message",this.onMessage)}}],[{key:"iframe",get:function(){return window.top!==window}},{key:"postMessage",value:function(t){var r=t.type,n=t.data,o=t.id;if(!e.iframe)throw Error('The "ArtplayerPluginIframe.postMessage" method can only be used in iframe');window.parent.postMessage({type:r,data:n,id:void 0===o?0:o},"*")}},{key:"onMessage",value:function(t){return(0,s._)(function(){var r,n,o,s,i,a,u;return(0,c._)(this,function(c){switch(c.label){case 0:if(!e.iframe)throw Error('The "ArtplayerPluginIframe.onMessage" method can only be used in iframe');if(n=(r=t.data).type,o=r.data,s=r.id,"commit"===n)return[3,1];return[3,7];case 1:if(c.trys.push([1,5,,6]),!o.match(/\bresolve\((.*?)\)/))return[3,3];return[4,Function("return new Promise(function(resolve){\n".concat(o,"\n})"))()];case 2:return i=c.sent(),e.postMessage({type:"response",data:i,id:s}),[3,4];case 3:a=Function(o)(),e.postMessage({type:"response",data:a,id:s}),c.label=4;case 4:return[3,6];case 5:throw u=c.sent(),e.postMessage({type:"error",data:u.message,id:s}),u;case 6:case 7:return[3,8];case 8:return[2]}})})()}},{key:"inject",value:function(){if(!e.iframe)throw Error('The "ArtplayerPluginIframe.inject" method can only be used in iframe');e.postMessage({type:"inject"}),window.addEventListener("message",e.onMessage)}}]),e}();"u">typeof windoLine truncated
|
||||
!function(e,t){"object"===typeof exports&&"undefined"!==typeof module?module.exports=t():"function"==typeof define&&define.amd?(t.ArtplayerPluginIframe=t(),define(function(){return t.ArtplayerPluginIframe})):(e="undefined"!==typeof globalThis?globalThis:e||self).ArtplayerPluginIframe=t()}(this,function(){"use strict";class e{static get iframe(){return window.top!==window}static postMessage({type:t,data:s,id:i=0}){if(!e.iframe)throw new Error('The "ArtplayerPluginIframe.postMessage" method can only be used in iframe');window.parent.postMessage({type:t,data:s,id:i},"*")}static onMessage(t){return s=this,i=null,n=function*(){if(!e.iframe)throw new Error('The "ArtplayerPluginIframe.onMessage" method can only be used in iframe');const{type:s,data:i,id:n}=t.data;if("commit"===s)try{if(i.match(/\bresolve\((.*?)\)/)){const t=`return new Promise(function(resolve){\n${i}\n})`,s=yield new Function(t)();e.postMessage({type:"response",data:s,id:n})}else{const t=new Function(i)();e.postMessage({type:"response",data:t,id:n})}}catch(r){throw e.postMessage({type:"error",data:r.message,id:n}),r}},new Promise((e,t)=>{var r=e=>{try{a(n.next(e))}catch(s){t(s)}},o=e=>{try{a(n.throw(e))}catch(s){t(s)}},a=t=>t.done?e(t.value):Promise.resolve(t.value).then(r,o);a((n=n.apply(s,i)).next())});var s,i,n}static inject(){if(!e.iframe)throw new Error('The "ArtplayerPluginIframe.inject" method can only be used in iframe');e.postMessage({type:"inject"}),window.addEventListener("message",e.onMessage)}constructor({iframe:e,url:t}){if(e instanceof HTMLIFrameElement===!1)throw new TypeError('"option.iframe" needs to be a HTMLIFrameElement');if("string"!==typeof t)throw new TypeError('"option.url" needs to be a string');this.url=t,this.$iframe=e,this.promises={},this.injected=!1,this.destroyed=!1,this.messageCallback=()=>null,this.onMessage=this.onMessage.bind(this),window.addEventListener("message",this.onMessage),this.$iframe.src=this.url}onMessage(e){const{type:t,data:s,id:i}=e.data;if("inject"===t)this.injected=!0;this.promises[i]&&("error"===t?this.promises[i].reject(new Error(s)):this.promises[i].resove(s),delete this.promises[i]),this.messageCallback&&this.messageCallback({type:t,data:s})}postMessage({type:e,data:t}){return new Promise((s,i)=>{(function n(){if(this.destroyed)i(new Error("The instance has been destroyed"));else if(this.injected){const n=Date.now();this.promises[n]={resove:s,reject:i},this.$iframe.contentWindow.postMessage({type:e,data:t,id:n},"*")}else setTimeout(n.bind(this),200)}).call(this)})}commit(e){if("function"!==typeof e)throw new TypeError('"commit.callback" needs to be a function');const t=e.toString(),s=t.substring(t.indexOf("{")+1,t.lastIndexOf("}"));return this.postMessage({type:"commit",data:s})}message(e){if("function"!==typeof e)throw new TypeError('"message.callback" needs to be a function');this.messageCallback=e}destroy(){this.destroyed=!0,window.removeEventListener("message",this.onMessage)}}return"undefined"!==typeof window&&(window.ArtplayerPluginIframe=e),e});
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-iframe.js v1.0.0
|
||||
* artplayer-plugin-iframe.js v1.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,o,s){var n="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},i="function"==typeof n[o]&&n[o],a=i.i||{},f=i.cache||{},l="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(t,r){if(!f[t]){if(!e[t]){if(s[t])return s[t];var a="function"==typeof n[o]&&n[o];if(!r&&a)return a(t,!0);if(i)return i(t,!0);if(l&&"string"==typeof t)return l(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){var o=e[t][1][r];return null!=o?o:r},p.cache={};var d=f[t]=new u.Module(t);e[t][0].call(d.exports,p,d,d.exports,n)}return f[t].exports;function p(e){var t=p.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],s=e[2]||e[0],n=u(o);"*"===t?Object.keys(n).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return n[e]}})}):"*"===s?Object.defineProperty(r,t,{enumerable:!0,value:n}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===s?n.__esModule?n.default:n:n[s]}})}),r}return u(t)}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.require=l,this.exports={}},u.modules=e,u.cache=f,u.parent=i,u.distDir=void 0,u.publicUrl=void 0,u.devServer=void 0,u.i=a,u.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(u,"root",{get:function(){return n[o]}}),n[o]=u;for(var c=0;c<t.length;c++)u(t[c]);if(r){var d=u(r);"object"==typeof exports&&"u">typeof module?module.exports=d:"function"==typeof define&&define.amd&&define(function(){return d})}}({bfwB8:[function(e,t,r,o){e("@parcel/transformer-js/src/esmodule-helpers.js").defineInteropFlag(r);class s{static get iframe(){return window.top!==window}static postMessage({type:e,data:t,id:r=0}){if(!s.iframe)throw Error('The "ArtplayerPluginIframe.postMessage" method can only be used in iframe');window.parent.postMessage({type:e,data:t,id:r},"*")}static async onMessage(e){if(!s.iframe)throw Error('The "ArtplayerPluginIframe.onMessage" method can only be used in iframe');let{type:t,data:r,id:o}=e.data;if("commit"===t)try{if(r.match(/\bresolve\((.*?)\)/)){let e=`return new Promise(function(resolve){ ${r} })`,t=await Function(e)();s.postMessage({type:"response",data:t,id:o})}else{let e=Function(r)();s.postMessage({type:"response",data:e,id:o})}}catch(e){throw s.postMessage({type:"error",data:e.message,id:o}),e}}static inject(){if(!s.iframe)throw Error('The "ArtplayerPluginIframe.inject" method can only be used in iframe');s.postMessage({type:"inject"}),window.addEventListener("message",s.onMessage)}constructor({iframe:e,url:t}){if(e instanceof HTMLIFrameElement==!1)throw TypeError('"option.iframe" needs to be a HTMLIFrameElement');if("string"!=typeof t)throw TypeError('"option.url" needs to be a string');this.url=t,this.$iframe=e,this.promises={},this.injected=!1,this.destroyed=!1,this.messageCallback=()=>null,this.onMessage=this.onMessage.bind(this),window.addEventListener("message",this.onMessage),this.$iframe.src=this.url}onMessage(e){let{type:t,data:r,id:o}=e.data;"inject"===t&&(this.injected=!0),this.promises[o]&&("error"===t?this.promises[o].reject(Error(r)):this.promises[o].resove(r),delete this.promises[o]),this.messageCallback&&this.messageCallback({type:t,data:r})}postMessage({type:e,data:t}){return new Promise((r,o)=>{(function s(){if(this.destroyed)o(Error("The instance has been destroyed"));else if(this.injected){let s=Date.now();this.promises[s]={resove:r,reject:o},this.$iframe.contentWindow.postMessage({type:e,data:t,id:s},"*")}else setTimeout(s.bind(this),200)}).call(this)})}commit(e){if("function"!=typeof e)throw TypeError('"commit.callback" needs to be a function');let t=e.toString(),r=t.substring(t.indexOf("{")+1,t.lastIndexOf("}"));return this.postMessage({type:"commit",data:r})}message(e){if("function"!=typeof e)throw TypeError('"message.callback" needs to be a function');this.messageCallback=e}destroy(){this.destroyed=!0,window.removeEventListener("message",this.onMessage)}}r.default=s,"u">typeof window&&(window.ArtplayerPluginIframe=s)},{"@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})}},{}]},["bfwB8"],"bfwB8","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("bfwB8");export{e as default};
|
||||
class e{static get iframe(){return window.top!==window}static postMessage({type:t,data:s,id:i=0}){if(!e.iframe)throw new Error('The "ArtplayerPluginIframe.postMessage" method can only be used in iframe');window.parent.postMessage({type:t,data:s,id:i},"*")}static async onMessage(t){if(!e.iframe)throw new Error('The "ArtplayerPluginIframe.onMessage" method can only be used in iframe');const{type:s,data:i,id:a}=t.data;if("commit"===s)try{if(i.match(/\bresolve\((.*?)\)/)){const t=`return new Promise(function(resolve){\n${i}\n})`,s=await new Function(t)();e.postMessage({type:"response",data:s,id:a})}else{const t=new Function(i)();e.postMessage({type:"response",data:t,id:a})}}catch(n){throw e.postMessage({type:"error",data:n.message,id:a}),n}}static inject(){if(!e.iframe)throw new Error('The "ArtplayerPluginIframe.inject" method can only be used in iframe');e.postMessage({type:"inject"}),window.addEventListener("message",e.onMessage)}constructor({iframe:e,url:t}){if(e instanceof HTMLIFrameElement===!1)throw new TypeError('"option.iframe" needs to be a HTMLIFrameElement');if("string"!==typeof t)throw new TypeError('"option.url" needs to be a string');this.url=t,this.$iframe=e,this.promises={},this.injected=!1,this.destroyed=!1,this.messageCallback=()=>null,this.onMessage=this.onMessage.bind(this),window.addEventListener("message",this.onMessage),this.$iframe.src=this.url}onMessage(e){const{type:t,data:s,id:i}=e.data;if("inject"===t)this.injected=!0;this.promises[i]&&("error"===t?this.promises[i].reject(new Error(s)):this.promises[i].resove(s),delete this.promises[i]),this.messageCallback&&this.messageCallback({type:t,data:s})}postMessage({type:e,data:t}){return new Promise((s,i)=>{(function a(){if(this.destroyed)i(new Error("The instance has been destroyed"));else if(this.injected){const a=Date.now();this.promises[a]={resove:s,reject:i},this.$iframe.contentWindow.postMessage({type:e,data:t,id:a},"*")}else setTimeout(a.bind(this),200)}).call(this)})}commit(e){if("function"!==typeof e)throw new TypeError('"commit.callback" needs to be a function');const t=e.toString(),s=t.substring(t.indexOf("{")+1,t.lastIndexOf("}"));return this.postMessage({type:"commit",data:s})}message(e){if("function"!==typeof e)throw new TypeError('"message.callback" needs to be a function');this.messageCallback=e}destroy(){this.destroyed=!0,window.removeEventListener("message",this.onMessage)}}"undefined"!==typeof window&&(window.ArtplayerPluginIframe=e);export{e as default};
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "artplayer-plugin-iframe",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "Iframe plugin for ArtPlayer",
|
||||
"author": "Harvey Zhao <laozhaochaguan@gmail.com>",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-jassub.js v1.0.0
|
||||
* artplayer-plugin-jassub.js v1.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,s,i,a){var r="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},n="function"==typeof r[i]&&r[i],o=n.i||{},h=n.cache||{},d="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function l(t,s){if(!h[t]){if(!e[t]){if(a[t])return a[t];var o="function"==typeof r[i]&&r[i];if(!s&&o)return o(t,!0);if(n)return n(t,!0);if(d&&"string"==typeof t)return d(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}m.resolve=function(s){var i=e[t][1][s];return null!=i?i:s},m.cache={};var u=h[t]=new l.Module(t);e[t][0].call(u.exports,m,u,u.exports,r)}return h[t].exports;function m(e){var t=m.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var s={__esModule:!0};return t.forEach(function(e){var t=e[0],i=e[1],a=e[2]||e[0],r=l(i);"*"===t?Object.keys(r).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(s,e)||Object.defineProperty(s,e,{enumerable:!0,get:function(){return r[e]}})}):"*"===a?Object.defineProperty(s,t,{enumerable:!0,value:r}):Object.defineProperty(s,t,{enumerable:!0,get:function(){return"default"===a?r.__esModule?r.default:r:r[a]}})}),s}return l(t)}}l.isParcelRequire=!0,l.Module=function(e){this.id=e,this.bundle=l,this.require=d,this.exports={}},l.modules=e,l.cache=h,l.parent=n,l.distDir=void 0,l.publicUrl=void 0,l.devServer=void 0,l.i=o,l.register=function(t,s){e[t]=[function(e,t){t.exports=s},{}]},Object.defineProperty(l,"root",{get:function(){return r[i]}}),r[i]=l;for(var c=0;c<t.length;c++)l(t[c]);if(s){var u=l(s);"object"==typeof exports&&"u">typeof module?module.exports=u:"function"==typeof define&&define.amd&&define(function(){return u})}}({g5KxT:[function(e,t,s,i){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(s),a.export(s,"default",()=>o);var r=e("./jassub.es.js"),n=a.interopDefault(r);function o(e){return t=>{let s=new(0,n.default)({video:t.video,...e});return s._canvasParent.style.zIndex=20,t.on("destroy",()=>{s.destroy()}),{name:"artplayerPluginJassub",instance:s}}}"u">typeof window&&(window.artplayerPluginJassub=o)},{"./jassub.es.js":"8Qqq1","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"8Qqq1":[function(e,t,s,i){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(s),a.export(s,"default",()=>o),"u">typeof HTMLVideoElement&&!("requestVideoFrameCallback"in HTMLVideoElement.prototype)&&"getVideoPlaybackQuality"in HTMLVideoElement.prototype&&(HTMLVideoElement.prototype._rvfcpolyfillmap={},HTMLVideoElement.prototype.requestVideoFrameCallback=function(e){let t=performance.now(),s=this.getVideoPlaybackQuality(),i=this.mozPresentedFrames||this.mozPaintedFrames||s.totalVideoFrames-s.droppedVideoFrames,a=(r,n)=>{let o=this.getVideoPlaybackQuality(),h=this.mozPresentedFrames||this.mozPaintedFrames||o.totalVideoFrames-o.droppedVideoFrames;if(h>i){let i=this.mozFrameDelay||o.totalFrameDelay-s.totalFrameDelay||0,a=n-r;e(n,{presentationTime:n+1e3*i,expectedDisplayTime:n+a,width:this.videoWidth,height:this.videoHeight,mediaTime:Math.max(0,this.currentTime||0)+a/1e3,presentedFrames:h,processingDuration:i}),delete this._rvfcpolyfillmap[t]}else this._rvfcpolyfillmap[t]=requestAnimationFrame(e=>a(n,e))};return this._rvfcpolyfillmap[t]=requestAnimationFrame(e=>a(t,e)),t},HTMLVideoElement.prototype.cancelVideoFrameCallback=function(e){cancelAnimationFrame(this._rvfcpolyfillmap[e]),delete this._rvfcpolyfillmap[e]});let r={bt709:"BT709",bt470bg:"BT601",smpte170m:"BT601"},n={BT601:{BT709:"1.0863 -0.0723 -0.014 0 0 0.0965 0.8451 0.0584 0 0 -0.0141 -0.0277 1.0418"},BT709:{BT601:"0.9137 0.0784 0.0079 0 0 -0.1049 1.1722 -0.0671 0 0 0.0096 0.0322 0.9582"},FCC:{BT709:"1.0873 -0.0736 -0.0137 0 0 0.0974 0.8494 0.0531 0 0 -0.0127 -0.0251 1.0378",BT601:"1.001 -0.0008 -0.0002 0 0 0.0009 1.005 -0.006 0 0 0.0013 0.0027 0.996"},SMPTE240M:{BT709:"0.9993 0.0006 0.0001 0 0 -0.0004 0.9812 0.0192 0 0 -0.0034 -0.0114 1.0148",BT601:"0.913 0.0774 0.0096 0 0 -0.1051 1.1508 -0.0456 0 0 0.0063 0.0207 0.973"}};class o extends EventTarget{constructor(e){if(super(),!globalThis.Worker)throw this.destroy("Worker not supported");if(!e)throw this.destroy("No options provided");this._loaded=new Promise(e=>{this._init=e});const t=o._test();if(this._onDemandRender="requestVideoFrameCallback"in HTMLVideoElement.prototype&&(e.onDemandRender??!0),this._offscreenRender="transferControlToOffscreen"in HTMLCanvasElement.prototype&&!e.canvas&&(e.offscreenRender??!0),this.timeOffset=e.timeOffset||0,this._video=e.video,this._videoHeight=0,this._videoWidth=0,this._videoColorSpace=null,this._canvas=e.canvas,this._video&&!this._canvas)this._canvasParent=document.createElement("div"),this._canvasParent.className="JASSUB",this._canvasParent.style.position="relative",this._canvas=this._createCanvas(),this._video.insertAdjacentElement("afterend",this._canvasParent);else if(!this._canvas)throw this.destroy("Don't know where to render: you should giveLine truncated
|
||||
!function(e,t){"object"===typeof exports&&"undefined"!==typeof module?module.exports=t():"function"==typeof define&&define.amd?(t.ArtplayerPluginJassub=t(),define(function(){return t.ArtplayerPluginJassub})):(e="undefined"!==typeof globalThis?globalThis:e||self).ArtplayerPluginJassub=t()}(this,function(){"use strict";var e=Object.defineProperty,t=(t,s,i)=>((t,s,i)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[s]=i)(t,"symbol"!==typeof s?s+"":s,i);typeof HTMLVideoElement<"u"&&!("requestVideoFrameCallback"in HTMLVideoElement.prototype)&&"getVideoPlaybackQuality"in HTMLVideoElement.prototype&&(HTMLVideoElement.prototype._rvfcpolyfillmap={},HTMLVideoElement.prototype.requestVideoFrameCallback=function(e){const t=performance.now(),s=this.getVideoPlaybackQuality(),i=this.mozPresentedFrames||this.mozPaintedFrames||s.totalVideoFrames-s.droppedVideoFrames,a=(r,n)=>{const o=this.getVideoPlaybackQuality(),h=this.mozPresentedFrames||this.mozPaintedFrames||o.totalVideoFrames-o.droppedVideoFrames;if(h>i){const i=this.mozFrameDelay||o.totalFrameDelay-s.totalFrameDelay||0,a=n-r;e(n,{presentationTime:n+1e3*i,expectedDisplayTime:n+a,width:this.videoWidth,height:this.videoHeight,mediaTime:Math.max(0,this.currentTime||0)+a/1e3,presentedFrames:h,processingDuration:i}),delete this._rvfcpolyfillmap[t]}else this._rvfcpolyfillmap[t]=requestAnimationFrame(e=>a(n,e))};return this._rvfcpolyfillmap[t]=requestAnimationFrame(e=>a(t,e)),t},HTMLVideoElement.prototype.cancelVideoFrameCallback=function(e){cancelAnimationFrame(this._rvfcpolyfillmap[e]),delete this._rvfcpolyfillmap[e]});const s={bt709:"BT709",bt470bg:"BT601",smpte170m:"BT601"},i={BT601:{BT709:"1.0863 -0.0723 -0.014 0 0 0.0965 0.8451 0.0584 0 0 -0.0141 -0.0277 1.0418"},BT709:{BT601:"0.9137 0.0784 0.0079 0 0 -0.1049 1.1722 -0.0671 0 0 0.0096 0.0322 0.9582"},FCC:{BT709:"1.0873 -0.0736 -0.0137 0 0 0.0974 0.8494 0.0531 0 0 -0.0127 -0.0251 1.0378",BT601:"1.001 -0.0008 -0.0002 0 0 0.0009 1.005 -0.006 0 0 0.0013 0.0027 0.996"},SMPTE240M:{BT709:"0.9993 0.0006 0.0001 0 0 -0.0004 0.9812 0.0192 0 0 -0.0034 -0.0114 1.0148",BT601:"0.913 0.0774 0.0096 0 0 -0.1051 1.1508 -0.0456 0 0 0.0063 0.0207 0.973"}},a=class e extends EventTarget{constructor(t){if(super(),!globalThis.Worker)throw this.destroy("Worker not supported");if(!t)throw this.destroy("No options provided");this._loaded=new Promise(e=>{this._init=e});const s=e._test();if(this._onDemandRender="requestVideoFrameCallback"in HTMLVideoElement.prototype&&(t.onDemandRender??!0),this._offscreenRender="transferControlToOffscreen"in HTMLCanvasElement.prototype&&!t.canvas&&(t.offscreenRender??!0),this.timeOffset=t.timeOffset||0,this._video=t.video,this._videoHeight=0,this._videoWidth=0,this._videoColorSpace=null,this._canvas=t.canvas,this._video&&!this._canvas)this._canvasParent=document.createElement("div"),this._canvasParent.className="JASSUB",this._canvasParent.style.position="relative",this._canvas=this._createCanvas(),this._video.insertAdjacentElement("afterend",this._canvasParent);else if(!this._canvas)throw this.destroy("Don't know where to render: you should give video or canvas in options.");if(this._bufferCanvas=document.createElement("canvas"),this._bufferCtx=this._bufferCanvas.getContext("2d"),!this._bufferCtx)throw this.destroy("Canvas rendering not supported");this._canvasctrl=this._offscreenRender?this._canvas.transferControlToOffscreen():this._canvas,this._ctx=!this._offscreenRender&&this._canvasctrl.getContext("2d"),this._lastRenderTime=0,this.debug=!!t.debug,this.prescaleFactor=t.prescaleFactor||1,this.prescaleHeightLimit=t.prescaleHeightLimit||1080,this.maxRenderHeight=t.maxRenderHeight||0,this._boundResize=this.resize.bind(this),this._boundTimeUpdate=this._timeupdate.bind(this),this._boundSetRate=this.setRate.bind(this),this._boundUpdateColorSpace=this._updateColorSpace.bind(this),this._video&&this.setVideo(t.video),this._onDemandRender&&(this.busy=!1,this._lastDemandTime=null),this._worker=new Worker(t.workerUrl||"jassub-worker.js"),this._worker.onmessage=e=>this._onmessage(e),this._worker.onerror=e=>this._error(e),s.then(()=>{this._worker.postMessage({target:"init",wasmUrl:e._supportsSIMD&&t.modernWasmUrl?t.modernWasmUrl:t.wasmUrl??"jassub-worker.wasm",legacyWasmUrl:t.legacyWasmUrl??"jassub-worker.wasm.js",asyncRender:typeof createImageBitmap<"u"&&(t.asyncRender??!0),onDemandRender:this._onDemandRender,width:this._canvasctrl.width||0,height:this._canvasctrl.height||0,blendMode:t.blendMode||"js",subUrl:t.subUrl,subContent:t.subContent||null,fonts:t.fonts||[],availableFonts:t.availableFonts||{"liberation sans":"./default.woff2"},fallbackFont:t.fallbackFont||"liberation sans",debug:this.debug,targetFps:t.targetFps||24,dropAllAnimations:t.dropAllAnimations,dropAllBlur:t.dropAllBlur,libassMemoryLimit:t.libassMemoryLimit||0,libassGlyphLimit:t.libassGlyphLimit||0,useLocalFonts:typeof queryLocalFonts<"u"&&(t.useLocalFonts??!0),hasBitmapBug:e._hasBitmapBug}),!0===this._offscreenRender&&this.sendMessage("ofLine truncated
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-jassub.js v1.0.0
|
||||
* artplayer-plugin-jassub.js v1.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,n,i){var a="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},s="function"==typeof a[n]&&a[n],o=s.i||{},c=s.cache||{},l="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(t,r){if(!c[t]){if(!e[t]){if(i[t])return i[t];var o="function"==typeof a[n]&&a[n];if(!r&&o)return o(t,!0);if(s)return s(t,!0);if(l&&"string"==typeof t)return l(t);var d=Error("Cannot find module '"+t+"'");throw d.code="MODULE_NOT_FOUND",d}h.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},h.cache={};var f=c[t]=new u.Module(t);e[t][0].call(f.exports,h,f,f.exports,a)}return c[t].exports;function h(e){var t=h.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],i=e[2]||e[0],a=u(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]}})}):"*"===i?Object.defineProperty(r,t,{enumerable:!0,value:a}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===i?a.__esModule?a.default:a:a[i]}})}),r}return u(t)}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.require=l,this.exports={}},u.modules=e,u.cache=c,u.parent=s,u.distDir=void 0,u.publicUrl=void 0,u.devServer=void 0,u.i=o,u.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(u,"root",{get:function(){return a[n]}}),a[n]=u;for(var d=0;d<t.length;d++)u(t[d]);if(r){var f=u(r);"object"==typeof exports&&"u">typeof module?module.exports=f:"function"==typeof define&&define.amd&&define(function(){return f})}}({k1Tni:[function(e,t,r,n){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"default",function(){return c});var a=e("@swc/helpers/cjs/_object_spread.cjs"),s=e("./jassub.es.js"),o=i.interopDefault(s);function c(e){return function(t){var r=new(0,o.default)((0,a._)({video:t.video},e));return r._canvasParent.style.zIndex=20,t.on("destroy",function(){r.destroy()}),{name:"artplayerPluginJassub",instance:r}}}"u">typeof window&&(window.artplayerPluginJassub=c)},{"@swc/helpers/cjs/_object_spread.cjs":"kyoEj","./jassub.es.js":"5H1mY","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],kyoEj:[function(e,t,r,n){"use strict";var i=e("9f9b8a24218ee51e");r._=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){i._(e,t,r[t])})}return e}},{"9f9b8a24218ee51e":"ltU3W"}],ltU3W:[function(e,t,r,n){"use strict";r._=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},{}],"5H1mY":[function(e,t,r,n){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"default",function(){return b});var a=e("@swc/helpers/cjs/_async_to_generator.cjs"),s=e("@swc/helpers/cjs/_call_super.cjs"),o=e("@swc/helpers/cjs/_class_call_check.cjs"),c=e("@swc/helpers/cjs/_create_class.cjs"),l=e("@swc/helpers/cjs/_define_property.cjs"),u=e("@swc/helpers/cjs/_inherits.cjs"),d=e("@swc/helpers/cjs/_object_spread.cjs"),f=e("@swc/helpers/cjs/_sliced_to_array.cjs"),h=e("@swc/helpers/cjs/_to_consumable_array.cjs"),_=e("@swc/helpers/cjs/_type_of.cjs"),v=e("@swc/helpers/cjs/_wrap_native_super.cjs"),p=e("@swc/helpers/cjs/_ts_generator.cjs");("u"<typeof HTMLVideoElement?"undefined":(0,_._)(HTMLVideoElement))<"u"&&!("requestVideoFrameCallback"in HTMLVideoElement.prototype)&&"getVideoPlaybackQuality"in HTMLVideoElement.prototype&&(HTMLVideoElement.prototype._rvfcpolyfillmap={},HTMLVideoElement.prototype.requestVideoFrameCallback=function(e){var t=this,r=performance.now(),n=this.getVideoPlaybackQuality(),i=this.mozPresentedFrames||this.mozPaintedFrames||n.totalVideoFrames-n.droppedVideoFrames,a=function(s,o){var c=t.getVideoPlaybackQuality(),l=t.mozPresentedFrames||t.mozPaintedFrames||c.totalVideoFrames-c.droppedVideoFrames;if(l>i){var u=t.mozFrameDelay||c.totalFrameDelay-n.totalFrameDelay||0,d=o-s;e(o,{presentationTime:o+1e3*u,expectedDisplayTime:o+d,width:t.videoWidth,height:t.videoHeight,mediaTime:Math.max(0,t.currentTime||0)+d/1e3,presentedFrames:l,processingDuration:u}),delete t._rvfcpolyfillmap[r]}else t._rvfcpolyfillmap[r]=requestAnimationFrame(function(e){return a(o,e)})};return this._rvfcpolyfillmap[r]=requestAnimationFrame(function(e){return a(r,e)}),r},HTMLVideoElement.prototype.cancelVideoFrameCallback=function(e){cancelAnimationFrame(this._rvfcpolyfillmap[e]),delete this._rvfcpolyfillmap[e]});var m={bt709:"BT709",bt470bg:"BT601",smpte170m:"BT601"},y={BT601:{BT709:"1.0863 -0.0723 -0.014 0 0 0.0965 0.8451 0.0584 0 0 -0.0141 -0.0277 1.0418"},BT709:{BT601:"0.9137 0.0784 0.0079 0 0 -Line truncated
|
||||
!function(e,t){"object"===typeof exports&&"undefined"!==typeof module?module.exports=t():"function"==typeof define&&define.amd?(t.ArtplayerPluginJassub=t(),define(function(){return t.ArtplayerPluginJassub})):(e="undefined"!==typeof globalThis?globalThis:e||self).ArtplayerPluginJassub=t()}(this,function(){"use strict";var e=Object.defineProperty,t=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,a=(t,s,i)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[s]=i,r=(e,r)=>{for(var n in r||(r={}))s.call(r,n)&&a(e,n,r[n]);if(t)for(var n of t(r))i.call(r,n)&&a(e,n,r[n]);return e},n=(e,t,s)=>a(e,"symbol"!==typeof t?t+"":t,s),o=(e,t,s)=>new Promise((i,a)=>{var r=e=>{try{o(s.next(e))}catch(t){a(t)}},n=e=>{try{o(s.throw(e))}catch(t){a(t)}},o=e=>e.done?i(e.value):Promise.resolve(e.value).then(r,n);o((s=s.apply(e,t)).next())});typeof HTMLVideoElement<"u"&&!("requestVideoFrameCallback"in HTMLVideoElement.prototype)&&"getVideoPlaybackQuality"in HTMLVideoElement.prototype&&(HTMLVideoElement.prototype._rvfcpolyfillmap={},HTMLVideoElement.prototype.requestVideoFrameCallback=function(e){const t=performance.now(),s=this.getVideoPlaybackQuality(),i=this.mozPresentedFrames||this.mozPaintedFrames||s.totalVideoFrames-s.droppedVideoFrames,a=(r,n)=>{const o=this.getVideoPlaybackQuality(),h=this.mozPresentedFrames||this.mozPaintedFrames||o.totalVideoFrames-o.droppedVideoFrames;if(h>i){const i=this.mozFrameDelay||o.totalFrameDelay-s.totalFrameDelay||0,a=n-r;e(n,{presentationTime:n+1e3*i,expectedDisplayTime:n+a,width:this.videoWidth,height:this.videoHeight,mediaTime:Math.max(0,this.currentTime||0)+a/1e3,presentedFrames:h,processingDuration:i}),delete this._rvfcpolyfillmap[t]}else this._rvfcpolyfillmap[t]=requestAnimationFrame(e=>a(n,e))};return this._rvfcpolyfillmap[t]=requestAnimationFrame(e=>a(t,e)),t},HTMLVideoElement.prototype.cancelVideoFrameCallback=function(e){cancelAnimationFrame(this._rvfcpolyfillmap[e]),delete this._rvfcpolyfillmap[e]});const h={bt709:"BT709",bt470bg:"BT601",smpte170m:"BT601"},d={BT601:{BT709:"1.0863 -0.0723 -0.014 0 0 0.0965 0.8451 0.0584 0 0 -0.0141 -0.0277 1.0418"},BT709:{BT601:"0.9137 0.0784 0.0079 0 0 -0.1049 1.1722 -0.0671 0 0 0.0096 0.0322 0.9582"},FCC:{BT709:"1.0873 -0.0736 -0.0137 0 0 0.0974 0.8494 0.0531 0 0 -0.0127 -0.0251 1.0378",BT601:"1.001 -0.0008 -0.0002 0 0 0.0009 1.005 -0.006 0 0 0.0013 0.0027 0.996"},SMPTE240M:{BT709:"0.9993 0.0006 0.0001 0 0 -0.0004 0.9812 0.0192 0 0 -0.0034 -0.0114 1.0148",BT601:"0.913 0.0774 0.0096 0 0 -0.1051 1.1508 -0.0456 0 0 0.0063 0.0207 0.973"}},l=class e extends EventTarget{constructor(t){var s,i;if(super(),!globalThis.Worker)throw this.destroy("Worker not supported");if(!t)throw this.destroy("No options provided");this._loaded=new Promise(e=>{this._init=e});const a=e._test();if(this._onDemandRender="requestVideoFrameCallback"in HTMLVideoElement.prototype&&(null==(s=t.onDemandRender)||s),this._offscreenRender="transferControlToOffscreen"in HTMLCanvasElement.prototype&&!t.canvas&&(null==(i=t.offscreenRender)||i),this.timeOffset=t.timeOffset||0,this._video=t.video,this._videoHeight=0,this._videoWidth=0,this._videoColorSpace=null,this._canvas=t.canvas,this._video&&!this._canvas)this._canvasParent=document.createElement("div"),this._canvasParent.className="JASSUB",this._canvasParent.style.position="relative",this._canvas=this._createCanvas(),this._video.insertAdjacentElement("afterend",this._canvasParent);else if(!this._canvas)throw this.destroy("Don't know where to render: you should give video or canvas in options.");if(this._bufferCanvas=document.createElement("canvas"),this._bufferCtx=this._bufferCanvas.getContext("2d"),!this._bufferCtx)throw this.destroy("Canvas rendering not supported");this._canvasctrl=this._offscreenRender?this._canvas.transferControlToOffscreen():this._canvas,this._ctx=!this._offscreenRender&&this._canvasctrl.getContext("2d"),this._lastRenderTime=0,this.debug=!!t.debug,this.prescaleFactor=t.prescaleFactor||1,this.prescaleHeightLimit=t.prescaleHeightLimit||1080,this.maxRenderHeight=t.maxRenderHeight||0,this._boundResize=this.resize.bind(this),this._boundTimeUpdate=this._timeupdate.bind(this),this._boundSetRate=this.setRate.bind(this),this._boundUpdateColorSpace=this._updateColorSpace.bind(this),this._video&&this.setVideo(t.video),this._onDemandRender&&(this.busy=!1,this._lastDemandTime=null),this._worker=new Worker(t.workerUrl||"jassub-worker.js"),this._worker.onmessage=e=>this._onmessage(e),this._worker.onerror=e=>this._error(e),a.then(()=>{var s,i,a,r;this._worker.postMessage({target:"init",wasmUrl:e._supportsSIMD&&t.modernWasmUrl?t.modernWasmUrl:null!=(s=t.wasmUrl)?s:"jassub-worker.wasm",legacyWasmUrl:null!=(i=t.legacyWasmUrl)?i:"jassub-worker.wasm.js",asyncRender:typeof createImageBitmap<"u"&&(null==(a=t.asyncRender)||a),onDemandRender:this._onDemandRender,width:this._canvasctrl.width||0,height:this._canvasctrl.height||0,blendMode:t.blendMode||"js",subUrl:t.subUrl,subLine truncated
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-jassub.js v1.0.0
|
||||
* artplayer-plugin-jassub.js v1.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,s,i,a){var r="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},n="function"==typeof r[i]&&r[i],o=n.i||{},h=n.cache||{},d="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function l(t,s){if(!h[t]){if(!e[t]){if(a[t])return a[t];var o="function"==typeof r[i]&&r[i];if(!s&&o)return o(t,!0);if(n)return n(t,!0);if(d&&"string"==typeof t)return d(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}m.resolve=function(s){var i=e[t][1][s];return null!=i?i:s},m.cache={};var u=h[t]=new l.Module(t);e[t][0].call(u.exports,m,u,u.exports,r)}return h[t].exports;function m(e){var t=m.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var s={__esModule:!0};return t.forEach(function(e){var t=e[0],i=e[1],a=e[2]||e[0],r=l(i);"*"===t?Object.keys(r).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(s,e)||Object.defineProperty(s,e,{enumerable:!0,get:function(){return r[e]}})}):"*"===a?Object.defineProperty(s,t,{enumerable:!0,value:r}):Object.defineProperty(s,t,{enumerable:!0,get:function(){return"default"===a?r.__esModule?r.default:r:r[a]}})}),s}return l(t)}}l.isParcelRequire=!0,l.Module=function(e){this.id=e,this.bundle=l,this.require=d,this.exports={}},l.modules=e,l.cache=h,l.parent=n,l.distDir=void 0,l.publicUrl=void 0,l.devServer=void 0,l.i=o,l.register=function(t,s){e[t]=[function(e,t){t.exports=s},{}]},Object.defineProperty(l,"root",{get:function(){return r[i]}}),r[i]=l;for(var c=0;c<t.length;c++)l(t[c]);if(s){var u=l(s);"object"==typeof exports&&"u">typeof module?module.exports=u:"function"==typeof define&&define.amd&&define(function(){return u})}}({bm4Y0:[function(e,t,s,i){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(s),a.export(s,"default",()=>o);var r=e("./jassub.es.js"),n=a.interopDefault(r);function o(e){return t=>{let s=new(0,n.default)({video:t.video,...e});return s._canvasParent.style.zIndex=20,t.on("destroy",()=>{s.destroy()}),{name:"artplayerPluginJassub",instance:s}}}"u">typeof window&&(window.artplayerPluginJassub=o)},{"./jassub.es.js":"kL36e","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],kL36e:[function(e,t,s,i){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(s),a.export(s,"default",()=>o),"u">typeof HTMLVideoElement&&!("requestVideoFrameCallback"in HTMLVideoElement.prototype)&&"getVideoPlaybackQuality"in HTMLVideoElement.prototype&&(HTMLVideoElement.prototype._rvfcpolyfillmap={},HTMLVideoElement.prototype.requestVideoFrameCallback=function(e){let t=performance.now(),s=this.getVideoPlaybackQuality(),i=this.mozPresentedFrames||this.mozPaintedFrames||s.totalVideoFrames-s.droppedVideoFrames,a=(r,n)=>{let o=this.getVideoPlaybackQuality(),h=this.mozPresentedFrames||this.mozPaintedFrames||o.totalVideoFrames-o.droppedVideoFrames;if(h>i){let i=this.mozFrameDelay||o.totalFrameDelay-s.totalFrameDelay||0,a=n-r;e(n,{presentationTime:n+1e3*i,expectedDisplayTime:n+a,width:this.videoWidth,height:this.videoHeight,mediaTime:Math.max(0,this.currentTime||0)+a/1e3,presentedFrames:h,processingDuration:i}),delete this._rvfcpolyfillmap[t]}else this._rvfcpolyfillmap[t]=requestAnimationFrame(e=>a(n,e))};return this._rvfcpolyfillmap[t]=requestAnimationFrame(e=>a(t,e)),t},HTMLVideoElement.prototype.cancelVideoFrameCallback=function(e){cancelAnimationFrame(this._rvfcpolyfillmap[e]),delete this._rvfcpolyfillmap[e]});let r={bt709:"BT709",bt470bg:"BT601",smpte170m:"BT601"},n={BT601:{BT709:"1.0863 -0.0723 -0.014 0 0 0.0965 0.8451 0.0584 0 0 -0.0141 -0.0277 1.0418"},BT709:{BT601:"0.9137 0.0784 0.0079 0 0 -0.1049 1.1722 -0.0671 0 0 0.0096 0.0322 0.9582"},FCC:{BT709:"1.0873 -0.0736 -0.0137 0 0 0.0974 0.8494 0.0531 0 0 -0.0127 -0.0251 1.0378",BT601:"1.001 -0.0008 -0.0002 0 0 0.0009 1.005 -0.006 0 0 0.0013 0.0027 0.996"},SMPTE240M:{BT709:"0.9993 0.0006 0.0001 0 0 -0.0004 0.9812 0.0192 0 0 -0.0034 -0.0114 1.0148",BT601:"0.913 0.0774 0.0096 0 0 -0.1051 1.1508 -0.0456 0 0 0.0063 0.0207 0.973"}};class o extends EventTarget{constructor(e){if(super(),!globalThis.Worker)throw this.destroy("Worker not supported");if(!e)throw this.destroy("No options provided");this._loaded=new Promise(e=>{this._init=e});let t=o._test();if(this._onDemandRender="requestVideoFrameCallback"in HTMLVideoElement.prototype&&(e.onDemandRender??!0),this._offscreenRender="transferControlToOffscreen"in HTMLCanvasElement.prototype&&!e.canvas&&(e.offscreenRender??!0),this.timeOffset=e.timeOffset||0,this._video=e.video,this._videoHeight=0,this._videoWidth=0,this._videoColorSpace=null,this._canvas=e.canvas,this._video&&!this._canvas)this._canvasParent=document.createElement("div"),this._canvasParent.className="JASSUB",this._canvasParent.style.position="relative",this._canvas=this._createCanvas(),this._video.insertAdjacentElement("afterend",this._canvasParent);else if(!this._canvas)throw this.destroy("Don't know where to render: you should give vidLine truncated
|
||||
var e=Object.defineProperty,t=(t,s,i)=>((t,s,i)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[s]=i)(t,"symbol"!==typeof s?s+"":s,i);typeof HTMLVideoElement<"u"&&!("requestVideoFrameCallback"in HTMLVideoElement.prototype)&&"getVideoPlaybackQuality"in HTMLVideoElement.prototype&&(HTMLVideoElement.prototype._rvfcpolyfillmap={},HTMLVideoElement.prototype.requestVideoFrameCallback=function(e){const t=performance.now(),s=this.getVideoPlaybackQuality(),i=this.mozPresentedFrames||this.mozPaintedFrames||s.totalVideoFrames-s.droppedVideoFrames,a=(r,n)=>{const o=this.getVideoPlaybackQuality(),h=this.mozPresentedFrames||this.mozPaintedFrames||o.totalVideoFrames-o.droppedVideoFrames;if(h>i){const i=this.mozFrameDelay||o.totalFrameDelay-s.totalFrameDelay||0,a=n-r;e(n,{presentationTime:n+1e3*i,expectedDisplayTime:n+a,width:this.videoWidth,height:this.videoHeight,mediaTime:Math.max(0,this.currentTime||0)+a/1e3,presentedFrames:h,processingDuration:i}),delete this._rvfcpolyfillmap[t]}else this._rvfcpolyfillmap[t]=requestAnimationFrame(e=>a(n,e))};return this._rvfcpolyfillmap[t]=requestAnimationFrame(e=>a(t,e)),t},HTMLVideoElement.prototype.cancelVideoFrameCallback=function(e){cancelAnimationFrame(this._rvfcpolyfillmap[e]),delete this._rvfcpolyfillmap[e]});const s={bt709:"BT709",bt470bg:"BT601",smpte170m:"BT601"},i={BT601:{BT709:"1.0863 -0.0723 -0.014 0 0 0.0965 0.8451 0.0584 0 0 -0.0141 -0.0277 1.0418"},BT709:{BT601:"0.9137 0.0784 0.0079 0 0 -0.1049 1.1722 -0.0671 0 0 0.0096 0.0322 0.9582"},FCC:{BT709:"1.0873 -0.0736 -0.0137 0 0 0.0974 0.8494 0.0531 0 0 -0.0127 -0.0251 1.0378",BT601:"1.001 -0.0008 -0.0002 0 0 0.0009 1.005 -0.006 0 0 0.0013 0.0027 0.996"},SMPTE240M:{BT709:"0.9993 0.0006 0.0001 0 0 -0.0004 0.9812 0.0192 0 0 -0.0034 -0.0114 1.0148",BT601:"0.913 0.0774 0.0096 0 0 -0.1051 1.1508 -0.0456 0 0 0.0063 0.0207 0.973"}},a=class e extends EventTarget{constructor(t){if(super(),!globalThis.Worker)throw this.destroy("Worker not supported");if(!t)throw this.destroy("No options provided");this._loaded=new Promise(e=>{this._init=e});const s=e._test();if(this._onDemandRender="requestVideoFrameCallback"in HTMLVideoElement.prototype&&(t.onDemandRender??!0),this._offscreenRender="transferControlToOffscreen"in HTMLCanvasElement.prototype&&!t.canvas&&(t.offscreenRender??!0),this.timeOffset=t.timeOffset||0,this._video=t.video,this._videoHeight=0,this._videoWidth=0,this._videoColorSpace=null,this._canvas=t.canvas,this._video&&!this._canvas)this._canvasParent=document.createElement("div"),this._canvasParent.className="JASSUB",this._canvasParent.style.position="relative",this._canvas=this._createCanvas(),this._video.insertAdjacentElement("afterend",this._canvasParent);else if(!this._canvas)throw this.destroy("Don't know where to render: you should give video or canvas in options.");if(this._bufferCanvas=document.createElement("canvas"),this._bufferCtx=this._bufferCanvas.getContext("2d"),!this._bufferCtx)throw this.destroy("Canvas rendering not supported");this._canvasctrl=this._offscreenRender?this._canvas.transferControlToOffscreen():this._canvas,this._ctx=!this._offscreenRender&&this._canvasctrl.getContext("2d"),this._lastRenderTime=0,this.debug=!!t.debug,this.prescaleFactor=t.prescaleFactor||1,this.prescaleHeightLimit=t.prescaleHeightLimit||1080,this.maxRenderHeight=t.maxRenderHeight||0,this._boundResize=this.resize.bind(this),this._boundTimeUpdate=this._timeupdate.bind(this),this._boundSetRate=this.setRate.bind(this),this._boundUpdateColorSpace=this._updateColorSpace.bind(this),this._video&&this.setVideo(t.video),this._onDemandRender&&(this.busy=!1,this._lastDemandTime=null),this._worker=new Worker(t.workerUrl||"jassub-worker.js"),this._worker.onmessage=e=>this._onmessage(e),this._worker.onerror=e=>this._error(e),s.then(()=>{this._worker.postMessage({target:"init",wasmUrl:e._supportsSIMD&&t.modernWasmUrl?t.modernWasmUrl:t.wasmUrl??"jassub-worker.wasm",legacyWasmUrl:t.legacyWasmUrl??"jassub-worker.wasm.js",asyncRender:typeof createImageBitmap<"u"&&(t.asyncRender??!0),onDemandRender:this._onDemandRender,width:this._canvasctrl.width||0,height:this._canvasctrl.height||0,blendMode:t.blendMode||"js",subUrl:t.subUrl,subContent:t.subContent||null,fonts:t.fonts||[],availableFonts:t.availableFonts||{"liberation sans":"./default.woff2"},fallbackFont:t.fallbackFont||"liberation sans",debug:this.debug,targetFps:t.targetFps||24,dropAllAnimations:t.dropAllAnimations,dropAllBlur:t.dropAllBlur,libassMemoryLimit:t.libassMemoryLimit||0,libassGlyphLimit:t.libassGlyphLimit||0,useLocalFonts:typeof queryLocalFonts<"u"&&(t.useLocalFonts??!0),hasBitmapBug:e._hasBitmapBug}),!0===this._offscreenRender&&this.sendMessage("offscreenCanvas",null,[this._canvasctrl])})}_createCanvas(){return this._canvas=document.createElement("canvas"),this._canvas.style.display="block",this._canvas.style.position="absolute",this._canvas.style.pointerEvents="none",this._canvasParent.appendChild(this._canvas),this._canvas}static _testSIMD(){if(null===e._suppLine truncated
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "artplayer-plugin-jassub",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "jassub plugin for ArtPlayer",
|
||||
"author": "Harvey Zhao <laozhaochaguan@gmail.com>",
|
||||
"license": "MIT",
|
||||
@@ -27,7 +27,6 @@
|
||||
"types": "./types/artplayer-plugin-jassub.d.ts",
|
||||
"import": "./dist/artplayer-plugin-jassub.legacy.js",
|
||||
"require": "./dist/artplayer-plugin-jassub.legacy.js"
|
||||
|
||||
}
|
||||
},
|
||||
"main": "dist/artplayer-plugin-jassub.js",
|
||||
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-multiple-subtitles.js v1.1.0
|
||||
* artplayer-plugin-multiple-subtitles.js v1.1.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,i,r){var a="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},o="function"==typeof a[i]&&a[i],s=o.i||{},l=o.cache||{},u="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,n){if(!l[t]){if(!e[t]){if(r[t])return r[t];var s="function"==typeof a[i]&&a[i];if(!n&&s)return s(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(n){var i=e[t][1][n];return null!=i?i:n},p.cache={};var d=l[t]=new f.Module(t);e[t][0].call(d.exports,p,d,d.exports,a)}return l[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],i=e[1],r=e[2]||e[0],a=f(i);"*"===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]}})}):"*"===r?Object.defineProperty(n,t,{enumerable:!0,value:a}):Object.defineProperty(n,t,{enumerable:!0,get:function(){return"default"===r?a.__esModule?a.default:a:a[r]}})}),n}return f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=u,this.exports={}},f.modules=e,f.cache=l,f.parent=o,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=s,f.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(f,"root",{get:function(){return a[i]}}),a[i]=f;for(var c=0;c<t.length;c++)f(t[c]);if(n){var d=f(n);"object"==typeof exports&&"u">typeof module?module.exports=d:"function"==typeof define&&define.amd&&define(function(){return d})}}({bY7Hk:[function(e,t,n,i){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(n),r.export(n,"default",()=>s);var a=e("./parser");async function o(e,{getExt:t,srtToVtt:n,assToVtt:i}){let r=await fetch(e.url),a=await r.arrayBuffer(),s=new TextDecoder(e.encoding||"utf-8").decode(a);switch(e.type||t(e.url)){case"srt":return n(s);case"ass":return i(s);case"vtt":return s;default:return""}}function s({subtitles:e=[]}){return async t=>{let{unescape:n,getExt:i,srtToVtt:r,assToVtt:s}=t.constructor.utils,l=new(0,a.WebVTTParser),u=new(0,a.WebVTTSerializer),f=(await Promise.all(e.map(e=>o(e,{getExt:i,srtToVtt:r,assToVtt:s})))).map((t,n)=>{let i=l.parse(t,"metadata");return i.url=e[n].url,i.name=e[n].name,i}),c="";function d(e=[]){let i=function(e){let t=new(0,a.WebVTTParser)().parse("","metadata");for(let n=0;n<e.length;n++){let i=e[n];if(!i.updated){i.updated=!0;for(let e=0;e<i.cues.length;e++){let t=i.cues[e];for(let e=0;e<t.tree.children.length;e++){let n=t.tree.children[e];n.value=`<div class="art-subtitle-${i.name}">${n.value}</div>`}}}t.cues.push(...i.cues)}return t}(e),r=u.serialize(i.cues);URL.revokeObjectURL(c);let o=URL.createObjectURL(new Blob([r],{type:"text/vtt"}));c=o,t.option.subtitle.escape=!1,t.subtitle.init({...t.option.subtitle,url:o,type:"vtt",onVttLoad:n})}return d(f),{name:"multipleSubtitles",tracks:(e=[])=>d(e.map(e=>f.find(t=>t.name===e))),reset:()=>d(f)}}}"u">typeof window&&(window.artplayerPluginMultipleSubtitles=s)},{"./parser":"je6kr","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],je6kr:[function(e,t,n,i){!function(){var e={direction:"horizontal",snapToLines:!0,linePosition:"auto",lineAlign:"start",textPosition:"auto",positionAlign:"auto",size:100,alignment:"center"},t=function(t){t||(t={"&":"&","<":"<",">":">","&lrm":"","&rlm":""," ":" "}),this.entities=t,this.parse=function(n,a){n=n.replace(/\0/g,"�");var o=Date.now(),s=0,l=n.split(/\r\n|\r|\n/),u=!1,f=[],c=[],d=[];function p(e,t){d.push({message:e,line:s+1,col:t})}var m=l[s],g=m.length,v="WEBVTT",h=0,b=v.length;for("\uFEFF"===m[0]&&(h=1,b+=1),(g<b||m.indexOf(v)!==0+h||g>b&&" "!==m[b]&&" "!==m[b])&&p('No valid signature. (File needs to start with "WEBVTT".)'),s++;""!=l[s]&&void 0!=l[s];){if(p("No blank line after the signature."),-1!=l[s].indexOf("--\x3e")){u=!0;break}s++}for(;void 0!=l[s];){for(;!u&&""==l[s];)s++;if(!u&&void 0==l[s])break;var T=Object.assign({},e,{id:"",startTime:0,endTime:0,pauseOnExit:!1,direction:"horizontal",snapToLines:!0,linePosition:"auto",lineAlign:"start",textPosition:"auto",positionAlign:"auto",size:100,alignment:"center",text:"",tree:null}),y=!0;if(-1==l[s].indexOf("--\x3e")){if(T.id=l[s],/^NOTE($|[ \t])/.test(T.id)){for(s++;""!=l[s]&&void 0!=l[s];)-1!=l[s].indexOf("--\x3e")&&p("Cannot have timestamp in a comment."),s++;continue}if(/^STYLE($|[ \t])/.test(T.id)){var x=[],w=!1;for(s++;""!=l[s]&&void 0!=l[s];)-1!=l[s].indexOf("--\x3e")&&(p("Cannot have timestamp in a style block."),w=!0),x.push(l[s]),s++;if(c.length){p("Style blocks cannot appear after the first cue.");continue}w||f.push(x.join("\n"));continue}if(""==l[++s]||void 0==l[s]){p("Cue identifier cannot be standalone.");continue}if(-1==l[s].indexOf("--\x3e")){y=!1,p("Cue identifier needs to be followed by
Line truncated
|
||||
!function(e,t){"object"===typeof exports&&"undefined"!==typeof module?module.exports=t():"function"==typeof define&&define.amd?(t.ArtplayerPluginMultipleSubtitles=t(),define(function(){return t.ArtplayerPluginMultipleSubtitles})):(e="undefined"!==typeof globalThis?globalThis:e||self).ArtplayerPluginMultipleSubtitles=t()}(this,function(){"use strict";var e={direction:"horizontal",snapToLines:!0,linePosition:"auto",lineAlign:"start",textPosition:"auto",positionAlign:"auto",size:100,alignment:"center"},t=function(t){t||(t={"&":"&","<":"<",">":">","&lrm":"\u200e","&rlm":"\u200f"," ":"\xa0"}),this.entities=t,this.parse=function(a,s){a=a.replace(/\0/g,"\ufffd");var r=Date.now(),o=0,l=a.split(/\r\n|\r|\n/),f=!1,u=[],c=[],d=[];function p(e,t){d.push({message:e,line:o+1,col:t})}var m=l[o],g=m.length,h="WEBVTT",v=0,b=6;for("\ufeff"===m[0]&&(v=1,b+=1),(g<b||m.indexOf(h)!==0+v||g>b&&" "!==m[b]&&"\t"!==m[b])&&p('No valid signature. (File needs to start with "WEBVTT".)'),o++;""!=l[o]&&void 0!=l[o];){if(p("No blank line after the signature."),-1!=l[o].indexOf("--\x3e")){f=!0;break}o++}for(;void 0!=l[o];){for(var x;!f&&""==l[o];)o++;if(!f&&void 0==l[o])break;x=Object.assign({},e,{id:"",startTime:0,endTime:0,pauseOnExit:!1,direction:"horizontal",snapToLines:!0,linePosition:"auto",lineAlign:"start",textPosition:"auto",positionAlign:"auto",size:100,alignment:"center",text:"",tree:null});var T=!0;if(-1==l[o].indexOf("--\x3e")){if(x.id=l[o],/^NOTE($|[ \t])/.test(x.id)){for(o++;""!=l[o]&&void 0!=l[o];)-1!=l[o].indexOf("--\x3e")&&p("Cannot have timestamp in a comment."),o++;continue}if(/^STYLE($|[ \t])/.test(x.id)){var y=[],w=!1;for(o++;""!=l[o]&&void 0!=l[o];)-1!=l[o].indexOf("--\x3e")&&(p("Cannot have timestamp in a style block."),w=!0),y.push(l[o]),o++;if(c.length){p("Style blocks cannot appear after the first cue.");continue}w||u.push(y.join("\n"));continue}if(""==l[++o]||void 0==l[o]){p("Cue identifier cannot be standalone.");continue}if(-1==l[o].indexOf("--\x3e")){T=!1,p("Cue identifier needs to be followed by timestamp.");continue}}f=!1;var O=new n(l[o],p),L=0;if(c.length>0&&(L=c[c.length-1].startTime),!T||O.parse(x,L)){for(o++;""!=l[o]&&void 0!=l[o];){if(-1!=l[o].indexOf("--\x3e")){p("Blank line missing before cue."),f=!0;break}""!=x.text&&(x.text+="\n"),x.text+=l[o],o++}var A=new i(x.text,p,s,t);x.tree=A.parse(x.startTime,x.endTime),c.push(x)}else for(x=null,o++;""!=l[o]&&void 0!=l[o];){if(-1!=l[o].indexOf("--\x3e")){f=!0;break}o++}}return c.sort(function(e,t){return e.startTime<t.startTime?-1:e.startTime>t.startTime?1:e.endTime>t.endTime?-1:e.endTime<t.endTime?1:0}),{cues:c,errors:d,time:Date.now()-r,styles:u}}},n=function(e,t){var n=/[\u0020\t\f]/,i=/[^\u0020\t\f]/,a=(e=e,0),s=function(e){t(e,a+1)};function r(t){for(;void 0!=e[a]&&t.test(e[a]);)a++}function o(t){for(var n="";void 0!=e[a]&&t.test(e[a]);)n+=e[a],a++;return n}function l(){var t,n,i,r,l="minutes";if(void 0!=e[a])if(/\d/.test(e[a]))if(((t=o(/\d/)).length>2||parseInt(t,10)>59)&&(l="hours"),":"==e[a])if(a++,2==(n=o(/\d/)).length){if("hours"==l||":"==e[a]){if(":"!=e[a])return void s("No seconds found or minutes is greater than 59.");if(a++,2!=(i=o(/\d/)).length)return void s("Must be exactly two digits.")}else{if(2!=t.length)return void s("Must be exactly two digits.");i=n,n=t,t="0"}if("."==e[a])if(a++,3==(r=o(/\d/)).length)if(parseInt(n,10)>59)s("You cannot have more than 59 minutes.");else{if(!(parseInt(i,10)>59))return 60*parseInt(t,10)*60+60*parseInt(n,10)+parseInt(i,10)+parseInt(r,10)/1e3;s("You cannot have more than 59 seconds.")}else s("Milliseconds must be given in three digits.");else s('No decimal separator (".") found.')}else s("Must be exactly two digits.");else s("No time unit separator found.");else s("Timestamp must start with a character in the range 0-9.");else s("No timestamp found.")}this.parse=function(t,o){if(r(n),t.startTime=l(),void 0!=t.startTime)if(t.startTime<o&&s("Start timestamp is not greater than or equal to start timestamp of previous cue."),i.test(e[a])&&s("Timestamp not separated from '--\x3e' by whitespace."),r(n),"-"==e[a])if(a++,"-"==e[a])if(a++,">"==e[a]){if(a++,i.test(e[a])&&s("'--\x3e' not separated from timestamp by whitespace."),r(n),t.endTime=l(),void 0!=t.endTime)return t.endTime<=t.startTime&&s("End timestamp is not greater than start timestamp."),i.test(e[a]),r(n),function(e,t){for(var i=e.split(n),a=[],r=0;r<i.length;r++)if(""!=i[r]){var o=i[r].indexOf(":"),l=i[r].slice(0,o),f=i[r].slice(o+1);if(-1!=a.indexOf(l)&&s("Duplicate setting."),a.push(l),""==f)return void s("No value for setting defined.");if("vertical"==l){if("rl"!=f&&"lr"!=f){s("Writing direction can only be set to 'rl' or 'rl'.");continue}t.direction=f}else if("line"==l){if(/,/.test(f)){var u=f.split(",");f=u[0];var c=u[1]}if(!/^[-\d](\d*)(\.\d+)?%?$/.test(f)){s("Line position takes a number or percentage.");continue}if(-1!=f.indexOf("-",1)){s("Line position can only have '-' at the start.");continue}if(-1!=f.indexOf("%")&&f.indexOf("%")!=f.Line truncated
|
||||
Vendored
+2
-3
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-multiple-subtitles.js v1.1.0
|
||||
* artplayer-plugin-multiple-subtitles.js v1.1.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,r,i){var o="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},a="function"==typeof o[r]&&o[r],s=a.i||{},c=a.cache||{},l="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(t,n){if(!c[t]){if(!e[t]){if(i[t])return i[t];var s="function"==typeof o[r]&&o[r];if(!n&&s)return s(t,!0);if(a)return a(t,!0);if(l&&"string"==typeof t)return l(t);var f=Error("Cannot find module '"+t+"'");throw f.code="MODULE_NOT_FOUND",f}p.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},p.cache={};var d=c[t]=new u.Module(t);e[t][0].call(d.exports,p,d,d.exports,o)}return c[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],r=e[1],i=e[2]||e[0],o=u(r);"*"===t?Object.keys(o).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:function(){return o[e]}})}):"*"===i?Object.defineProperty(n,t,{enumerable:!0,value:o}):Object.defineProperty(n,t,{enumerable:!0,get:function(){return"default"===i?o.__esModule?o.default:o:o[i]}})}),n}return u(t)}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.require=l,this.exports={}},u.modules=e,u.cache=c,u.parent=a,u.distDir=void 0,u.publicUrl=void 0,u.devServer=void 0,u.i=s,u.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(u,"root",{get:function(){return o[r]}}),o[r]=u;for(var f=0;f<t.length;f++)u(t[f]);if(n){var d=u(n);"object"==typeof exports&&"u">typeof module?module.exports=d:"function"==typeof define&&define.amd&&define(function(){return d})}}({bNEbP:[function(e,t,n,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"default",function(){return f});var o=e("@swc/helpers/cjs/_async_to_generator.cjs"),a=e("@swc/helpers/cjs/_object_spread.cjs"),s=e("@swc/helpers/cjs/_object_spread_props.cjs"),c=e("@swc/helpers/cjs/_to_consumable_array.cjs"),l=e("@swc/helpers/cjs/_ts_generator.cjs"),u=e("./parser");function f(e){var t=e.subtitles,n=void 0===t?[]:t;return function(e){return(0,o._)(function(){var t,r,i,f,d,p,v,h,m;function b(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=function(e){for(var t=new(0,u.WebVTTParser)().parse("","metadata"),n=0;n<e.length;n++){var r,i=e[n];if(!i.updated){i.updated=!0;for(var o=0;o<i.cues.length;o++)for(var a=i.cues[o],s=0;s<a.tree.children.length;s++){var l=a.tree.children[s];l.value='<div class="art-subtitle-'.concat(i.name,'">').concat(l.value,"</div>")}}(r=t.cues).push.apply(r,(0,c._)(i.cues))}return t}(t),i=v.serialize(n.cues);URL.revokeObjectURL(m);var o=URL.createObjectURL(new Blob([i],{type:"text/vtt"}));m=o,e.option.subtitle.escape=!1,e.subtitle.init((0,s._)((0,a._)({},e.option.subtitle),{url:o,type:"vtt",onVttLoad:r}))}return(0,l._)(this,function(a){switch(a.label){case 0:return r=(t=e.constructor.utils).unescape,i=t.getExt,f=t.srtToVtt,d=t.assToVtt,p=new(0,u.WebVTTParser),v=new(0,u.WebVTTSerializer),[4,Promise.all(n.map(function(e){return function(e,t){return(0,o._)(function(e,t){var n,r,i,o,a;return(0,l._)(this,function(s){switch(s.label){case 0:return n=t.getExt,r=t.srtToVtt,i=t.assToVtt,[4,fetch(e.url)];case 1:return[4,s.sent().arrayBuffer()];case 2:switch(o=s.sent(),a=new TextDecoder(e.encoding||"utf-8").decode(o),e.type||n(e.url)){case"srt":return[2,r(a)];case"ass":return[2,i(a)];case"vtt":return[2,a];default:return[2,""]}}})}).apply(this,arguments)}(e,{getExt:i,srtToVtt:f,assToVtt:d})}))];case 1:return h=a.sent().map(function(e,t){var r=p.parse(e,"metadata");return r.url=n[t].url,r.name=n[t].name,r}),m="",b(h),[2,{name:"multipleSubtitles",tracks:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return b(e.map(function(e){return h.find(function(t){return t.name===e})}))},reset:function(){return b(h)}}]}})})()}}"u">typeof window&&(window.artplayerPluginMultipleSubtitles=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/_to_consumable_array.cjs":"i81N6","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","./parser":"hxyrW","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],cZn0e:[function(e,t,n,r){"use strict";function i(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}n._=function(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function s(e){i(a,r,o,s,c,"next",e)}function c(e){i(a,r,o,s,c,"throw",e)}s(void 0)})}}},{}],kyoEj:[function(e,t,n,r){"use strict";var i=e("9f9b8a24218ee51e");n._=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){returLine truncated
|
||||
!function(e,t){"object"===typeof exports&&"undefined"!==typeof module?module.exports=t():"function"==typeof define&&define.amd?(t.ArtplayerPluginMultipleSubtitles=t(),define(function(){return t.ArtplayerPluginMultipleSubtitles})):(e="undefined"!==typeof globalThis?globalThis:e||self).ArtplayerPluginMultipleSubtitles=t()}(this,function(){"use strict";var e=Object.defineProperty,t=Object.defineProperties,n=Object.getOwnPropertyDescriptors,i=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,s=(t,n,i)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i,o=(e,t)=>{for(var n in t||(t={}))a.call(t,n)&&s(e,n,t[n]);if(i)for(var n of i(t))r.call(t,n)&&s(e,n,t[n]);return e},l=(e,t,n)=>new Promise((i,a)=>{var r=e=>{try{o(n.next(e))}catch(t){a(t)}},s=e=>{try{o(n.throw(e))}catch(t){a(t)}},o=e=>e.done?i(e.value):Promise.resolve(e.value).then(r,s);o((n=n.apply(e,t)).next())}),f={direction:"horizontal",snapToLines:!0,linePosition:"auto",lineAlign:"start",textPosition:"auto",positionAlign:"auto",size:100,alignment:"center"},u=function(e){e||(e={"&":"&","<":"<",">":">","&lrm":"\u200e","&rlm":"\u200f"," ":"\xa0"}),this.entities=e,this.parse=function(t,n){t=t.replace(/\0/g,"\ufffd");var i=Date.now(),a=0,r=t.split(/\r\n|\r|\n/),s=!1,o=[],l=[],u=[];function p(e,t){u.push({message:e,line:a+1,col:t})}var m=r[a],g=m.length,h="WEBVTT",v=0,b=6;for("\ufeff"===m[0]&&(v=1,b+=1),(g<b||m.indexOf(h)!==0+v||g>b&&" "!==m[b]&&"\t"!==m[b])&&p('No valid signature. (File needs to start with "WEBVTT".)'),a++;""!=r[a]&&void 0!=r[a];){if(p("No blank line after the signature."),-1!=r[a].indexOf("--\x3e")){s=!0;break}a++}for(;void 0!=r[a];){for(var x;!s&&""==r[a];)a++;if(!s&&void 0==r[a])break;x=Object.assign({},f,{id:"",startTime:0,endTime:0,pauseOnExit:!1,direction:"horizontal",snapToLines:!0,linePosition:"auto",lineAlign:"start",textPosition:"auto",positionAlign:"auto",size:100,alignment:"center",text:"",tree:null});var T=!0;if(-1==r[a].indexOf("--\x3e")){if(x.id=r[a],/^NOTE($|[ \t])/.test(x.id)){for(a++;""!=r[a]&&void 0!=r[a];)-1!=r[a].indexOf("--\x3e")&&p("Cannot have timestamp in a comment."),a++;continue}if(/^STYLE($|[ \t])/.test(x.id)){var y=[],w=!1;for(a++;""!=r[a]&&void 0!=r[a];)-1!=r[a].indexOf("--\x3e")&&(p("Cannot have timestamp in a style block."),w=!0),y.push(r[a]),a++;if(l.length){p("Style blocks cannot appear after the first cue.");continue}w||o.push(y.join("\n"));continue}if(""==r[++a]||void 0==r[a]){p("Cue identifier cannot be standalone.");continue}if(-1==r[a].indexOf("--\x3e")){T=!1,p("Cue identifier needs to be followed by timestamp.");continue}}s=!1;var O=new c(r[a],p),P=0;if(l.length>0&&(P=l[l.length-1].startTime),!T||O.parse(x,P)){for(a++;""!=r[a]&&void 0!=r[a];){if(-1!=r[a].indexOf("--\x3e")){p("Blank line missing before cue."),s=!0;break}""!=x.text&&(x.text+="\n"),x.text+=r[a],a++}var I=new d(x.text,p,n,e);x.tree=I.parse(x.startTime,x.endTime),l.push(x)}else for(x=null,a++;""!=r[a]&&void 0!=r[a];){if(-1!=r[a].indexOf("--\x3e")){s=!0;break}a++}}return l.sort(function(e,t){return e.startTime<t.startTime?-1:e.startTime>t.startTime?1:e.endTime>t.endTime?-1:e.endTime<t.endTime?1:0}),{cues:l,errors:u,time:Date.now()-i,styles:o}}},c=function(e,t){var n=/[\u0020\t\f]/,i=/[^\u0020\t\f]/,a=(e=e,0),r=function(e){t(e,a+1)};function s(t){for(;void 0!=e[a]&&t.test(e[a]);)a++}function o(t){for(var n="";void 0!=e[a]&&t.test(e[a]);)n+=e[a],a++;return n}function l(){var t,n,i,s,l="minutes";if(void 0!=e[a])if(/\d/.test(e[a]))if(((t=o(/\d/)).length>2||parseInt(t,10)>59)&&(l="hours"),":"==e[a])if(a++,2==(n=o(/\d/)).length){if("hours"==l||":"==e[a]){if(":"!=e[a])return void r("No seconds found or minutes is greater than 59.");if(a++,2!=(i=o(/\d/)).length)return void r("Must be exactly two digits.")}else{if(2!=t.length)return void r("Must be exactly two digits.");i=n,n=t,t="0"}if("."==e[a])if(a++,3==(s=o(/\d/)).length)if(parseInt(n,10)>59)r("You cannot have more than 59 minutes.");else{if(!(parseInt(i,10)>59))return 60*parseInt(t,10)*60+60*parseInt(n,10)+parseInt(i,10)+parseInt(s,10)/1e3;r("You cannot have more than 59 seconds.")}else r("Milliseconds must be given in three digits.");else r('No decimal separator (".") found.')}else r("Must be exactly two digits.");else r("No time unit separator found.");else r("Timestamp must start with a character in the range 0-9.");else r("No timestamp found.")}this.parse=function(t,o){if(s(n),t.startTime=l(),void 0!=t.startTime)if(t.startTime<o&&r("Start timestamp is not greater than or equal to start timestamp of previous cue."),i.test(e[a])&&r("Timestamp not separated from '--\x3e' by whitespace."),s(n),"-"==e[a])if(a++,"-"==e[a])if(a++,">"==e[a]){if(a++,i.test(e[a])&&r("'--\x3e' not separated from timestamp by whitespace."),s(n),t.endTime=l(),void 0!=t.endTime)return t.endTime<=t.startTime&&r("End timestamp is not greater than start timestamp."),i.test(e[a]),s(n),function(e,t){for(var i=e.split(n),a=[],s=0;s<i.length;s++)ifLine truncated
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-multiple-subtitles.js v1.1.0
|
||||
* artplayer-plugin-multiple-subtitles.js v1.1.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,i,r){var a="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},o="function"==typeof a[i]&&a[i],s=o.i||{},l=o.cache||{},u="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,n){if(!l[t]){if(!e[t]){if(r[t])return r[t];var s="function"==typeof a[i]&&a[i];if(!n&&s)return s(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(n){var i=e[t][1][n];return null!=i?i:n},p.cache={};var d=l[t]=new f.Module(t);e[t][0].call(d.exports,p,d,d.exports,a)}return l[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],i=e[1],r=e[2]||e[0],a=f(i);"*"===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]}})}):"*"===r?Object.defineProperty(n,t,{enumerable:!0,value:a}):Object.defineProperty(n,t,{enumerable:!0,get:function(){return"default"===r?a.__esModule?a.default:a:a[r]}})}),n}return f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=u,this.exports={}},f.modules=e,f.cache=l,f.parent=o,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=s,f.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(f,"root",{get:function(){return a[i]}}),a[i]=f;for(var c=0;c<t.length;c++)f(t[c]);if(n){var d=f(n);"object"==typeof exports&&"u">typeof module?module.exports=d:"function"==typeof define&&define.amd&&define(function(){return d})}}({b4OMP:[function(e,t,n,i){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(n),r.export(n,"default",()=>s);var a=e("./parser");async function o(e,{getExt:t,srtToVtt:n,assToVtt:i}){let r=await fetch(e.url),a=await r.arrayBuffer(),s=new TextDecoder(e.encoding||"utf-8").decode(a);switch(e.type||t(e.url)){case"srt":return n(s);case"ass":return i(s);case"vtt":return s;default:return""}}function s({subtitles:e=[]}){return async t=>{let{unescape:n,getExt:i,srtToVtt:r,assToVtt:s}=t.constructor.utils,l=new(0,a.WebVTTParser),u=new(0,a.WebVTTSerializer),f=(await Promise.all(e.map(e=>o(e,{getExt:i,srtToVtt:r,assToVtt:s})))).map((t,n)=>{let i=l.parse(t,"metadata");return i.url=e[n].url,i.name=e[n].name,i}),c="";function d(e=[]){let i=function(e){let t=new(0,a.WebVTTParser)().parse("","metadata");for(let n=0;n<e.length;n++){let i=e[n];if(!i.updated){i.updated=!0;for(let e=0;e<i.cues.length;e++){let t=i.cues[e];for(let e=0;e<t.tree.children.length;e++){let n=t.tree.children[e];n.value=`<div class="art-subtitle-${i.name}">${n.value}</div>`}}}t.cues.push(...i.cues)}return t}(e),r=u.serialize(i.cues);URL.revokeObjectURL(c);let o=URL.createObjectURL(new Blob([r],{type:"text/vtt"}));c=o,t.option.subtitle.escape=!1,t.subtitle.init({...t.option.subtitle,url:o,type:"vtt",onVttLoad:n})}return d(f),{name:"multipleSubtitles",tracks:(e=[])=>d(e.map(e=>f.find(t=>t.name===e))),reset:()=>d(f)}}}"u">typeof window&&(window.artplayerPluginMultipleSubtitles=s)},{"./parser":"3iLlq","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],"3iLlq":[function(e,t,n,i){!function(){var e={direction:"horizontal",snapToLines:!0,linePosition:"auto",lineAlign:"start",textPosition:"auto",positionAlign:"auto",size:100,alignment:"center"},t=function(t){t||(t={"&":"&","<":"<",">":">","&lrm":"","&rlm":""," ":" "}),this.entities=t,this.parse=function(n,a){n=n.replace(/\0/g,"�");var o=Date.now(),s=0,l=n.split(/\r\n|\r|\n/),u=!1,f=[],c=[],d=[];function p(e,t){d.push({message:e,line:s+1,col:t})}var m=l[s],g=m.length,v="WEBVTT",h=0,b=v.length;for("\uFEFF"===m[0]&&(h=1,b+=1),(g<b||m.indexOf(v)!==0+h||g>b&&" "!==m[b]&&" "!==m[b])&&p('No valid signature. (File needs to start with "WEBVTT".)'),s++;""!=l[s]&&void 0!=l[s];){if(p("No blank line after the signature."),-1!=l[s].indexOf("--\x3e")){u=!0;break}s++}for(;void 0!=l[s];){for(;!u&&""==l[s];)s++;if(!u&&void 0==l[s])break;var T=Object.assign({},e,{id:"",startTime:0,endTime:0,pauseOnExit:!1,direction:"horizontal",snapToLines:!0,linePosition:"auto",lineAlign:"start",textPosition:"auto",positionAlign:"auto",size:100,alignment:"center",text:"",tree:null}),y=!0;if(-1==l[s].indexOf("--\x3e")){if(T.id=l[s],/^NOTE($|[ \t])/.test(T.id)){for(s++;""!=l[s]&&void 0!=l[s];)-1!=l[s].indexOf("--\x3e")&&p("Cannot have timestamp in a comment."),s++;continue}if(/^STYLE($|[ \t])/.test(T.id)){var x=[],w=!1;for(s++;""!=l[s]&&void 0!=l[s];)-1!=l[s].indexOf("--\x3e")&&(p("Cannot have timestamp in a style block."),w=!0),x.push(l[s]),s++;if(c.length){p("Style blocks cannot appear after the first cue.");continue}w||f.push(x.join("\n"));continue}if(""==l[++s]||void 0==l[s]){p("Cue identifier cannot be standalone.");continue}if(-1==l[s].indexOf("--\x3e")){y=!1,p("Cue identifier needs to be followed bLine truncated
|
||||
var e={direction:"horizontal",snapToLines:!0,linePosition:"auto",lineAlign:"start",textPosition:"auto",positionAlign:"auto",size:100,alignment:"center"},t=function(t){t||(t={"&":"&","<":"<",">":">","&lrm":"\u200e","&rlm":"\u200f"," ":"\xa0"}),this.entities=t,this.parse=function(a,s){a=a.replace(/\0/g,"\ufffd");var r=Date.now(),o=0,l=a.split(/\r\n|\r|\n/),f=!1,c=[],u=[],d=[];function p(e,t){d.push({message:e,line:o+1,col:t})}var m=l[o],g=m.length,h="WEBVTT",v=0,b=6;for("\ufeff"===m[0]&&(v=1,b+=1),(g<b||m.indexOf(h)!==0+v||g>b&&" "!==m[b]&&"\t"!==m[b])&&p('No valid signature. (File needs to start with "WEBVTT".)'),o++;""!=l[o]&&void 0!=l[o];){if(p("No blank line after the signature."),-1!=l[o].indexOf("--\x3e")){f=!0;break}o++}for(;void 0!=l[o];){for(var x;!f&&""==l[o];)o++;if(!f&&void 0==l[o])break;x=Object.assign({},e,{id:"",startTime:0,endTime:0,pauseOnExit:!1,direction:"horizontal",snapToLines:!0,linePosition:"auto",lineAlign:"start",textPosition:"auto",positionAlign:"auto",size:100,alignment:"center",text:"",tree:null});var T=!0;if(-1==l[o].indexOf("--\x3e")){if(x.id=l[o],/^NOTE($|[ \t])/.test(x.id)){for(o++;""!=l[o]&&void 0!=l[o];)-1!=l[o].indexOf("--\x3e")&&p("Cannot have timestamp in a comment."),o++;continue}if(/^STYLE($|[ \t])/.test(x.id)){var y=[],w=!1;for(o++;""!=l[o]&&void 0!=l[o];)-1!=l[o].indexOf("--\x3e")&&(p("Cannot have timestamp in a style block."),w=!0),y.push(l[o]),o++;if(u.length){p("Style blocks cannot appear after the first cue.");continue}w||c.push(y.join("\n"));continue}if(""==l[++o]||void 0==l[o]){p("Cue identifier cannot be standalone.");continue}if(-1==l[o].indexOf("--\x3e")){T=!1,p("Cue identifier needs to be followed by timestamp.");continue}}f=!1;var O=new n(l[o],p),L=0;if(u.length>0&&(L=u[u.length-1].startTime),!T||O.parse(x,L)){for(o++;""!=l[o]&&void 0!=l[o];){if(-1!=l[o].indexOf("--\x3e")){p("Blank line missing before cue."),f=!0;break}""!=x.text&&(x.text+="\n"),x.text+=l[o],o++}var I=new i(x.text,p,s,t);x.tree=I.parse(x.startTime,x.endTime),u.push(x)}else for(x=null,o++;""!=l[o]&&void 0!=l[o];){if(-1!=l[o].indexOf("--\x3e")){f=!0;break}o++}}return u.sort(function(e,t){return e.startTime<t.startTime?-1:e.startTime>t.startTime?1:e.endTime>t.endTime?-1:e.endTime<t.endTime?1:0}),{cues:u,errors:d,time:Date.now()-r,styles:c}}},n=function(e,t){var n=/[\u0020\t\f]/,i=/[^\u0020\t\f]/,a=(e=e,0),s=function(e){t(e,a+1)};function r(t){for(;void 0!=e[a]&&t.test(e[a]);)a++}function o(t){for(var n="";void 0!=e[a]&&t.test(e[a]);)n+=e[a],a++;return n}function l(){var t,n,i,r,l="minutes";if(void 0!=e[a])if(/\d/.test(e[a]))if(((t=o(/\d/)).length>2||parseInt(t,10)>59)&&(l="hours"),":"==e[a])if(a++,2==(n=o(/\d/)).length){if("hours"==l||":"==e[a]){if(":"!=e[a])return void s("No seconds found or minutes is greater than 59.");if(a++,2!=(i=o(/\d/)).length)return void s("Must be exactly two digits.")}else{if(2!=t.length)return void s("Must be exactly two digits.");i=n,n=t,t="0"}if("."==e[a])if(a++,3==(r=o(/\d/)).length)if(parseInt(n,10)>59)s("You cannot have more than 59 minutes.");else{if(!(parseInt(i,10)>59))return 60*parseInt(t,10)*60+60*parseInt(n,10)+parseInt(i,10)+parseInt(r,10)/1e3;s("You cannot have more than 59 seconds.")}else s("Milliseconds must be given in three digits.");else s('No decimal separator (".") found.')}else s("Must be exactly two digits.");else s("No time unit separator found.");else s("Timestamp must start with a character in the range 0-9.");else s("No timestamp found.")}this.parse=function(t,o){if(r(n),t.startTime=l(),void 0!=t.startTime)if(t.startTime<o&&s("Start timestamp is not greater than or equal to start timestamp of previous cue."),i.test(e[a])&&s("Timestamp not separated from '--\x3e' by whitespace."),r(n),"-"==e[a])if(a++,"-"==e[a])if(a++,">"==e[a]){if(a++,i.test(e[a])&&s("'--\x3e' not separated from timestamp by whitespace."),r(n),t.endTime=l(),void 0!=t.endTime)return t.endTime<=t.startTime&&s("End timestamp is not greater than start timestamp."),i.test(e[a]),r(n),function(e,t){for(var i=e.split(n),a=[],r=0;r<i.length;r++)if(""!=i[r]){var o=i[r].indexOf(":"),l=i[r].slice(0,o),f=i[r].slice(o+1);if(-1!=a.indexOf(l)&&s("Duplicate setting."),a.push(l),""==f)return void s("No value for setting defined.");if("vertical"==l){if("rl"!=f&&"lr"!=f){s("Writing direction can only be set to 'rl' or 'rl'.");continue}t.direction=f}else if("line"==l){if(/,/.test(f)){var c=f.split(",");f=c[0];var u=c[1]}if(!/^[-\d](\d*)(\.\d+)?%?$/.test(f)){s("Line position takes a number or percentage.");continue}if(-1!=f.indexOf("-",1)){s("Line position can only have '-' at the start.");continue}if(-1!=f.indexOf("%")&&f.indexOf("%")!=f.length-1){s("Line position can only have '%' at the end.");continue}if("-"==f[0]&&"%"==f[f.length-1]){s("Line position cannot be a negative percentage.");continue}var d=f,p=!1;if("%"==f[f.length-1]&&(p=!0,d=f.slice(0,f.length-1),parseInt(f,10)>100)){s("Line position cannot be >100%.");continue}if(""===d||isNaN(d)||!isFinite(d)){s("Line position needsLine truncated
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "artplayer-plugin-multiple-subtitles",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.1",
|
||||
"description": "multiple subtitles plugin for ArtPlayer",
|
||||
"author": "Harvey Zhao <laozhaochaguan@gmail.com>",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
// Not intended to be fast, but if you can make it faster, please help out!
|
||||
|
||||
/* eslint-disable */
|
||||
(function () {
|
||||
var defaultCueSettings = {
|
||||
var defaultCueSettings = {
|
||||
direction: 'horizontal',
|
||||
snapToLines: true,
|
||||
linePosition: 'auto',
|
||||
@@ -886,12 +885,4 @@
|
||||
};
|
||||
};
|
||||
|
||||
function exportify(object) {
|
||||
object.WebVTTParser = WebVTTParser;
|
||||
object.WebVTTCueTimingsAndSettingsParser = WebVTTCueTimingsAndSettingsParser;
|
||||
object.WebVTTCueTextParser = WebVTTCueTextParser;
|
||||
object.WebVTTSerializer = WebVTTSerializer;
|
||||
}
|
||||
if (typeof window !== 'undefined') exportify(window);
|
||||
if (typeof exports !== 'undefined') exportify(exports);
|
||||
})();
|
||||
export { WebVTTParser, WebVTTCueTimingsAndSettingsParser, WebVTTCueTextParser, WebVTTSerializer };
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-vast.js v1.1.0
|
||||
* artplayer-plugin-vast.js v1.1.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,i,n,r){var s="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},o="function"==typeof s[n]&&s[n],a=o.i||{},u=o.cache||{},d="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function h(t,i){if(!u[t]){if(!e[t]){if(r[t])return r[t];var a="function"==typeof s[n]&&s[n];if(!i&&a)return a(t,!0);if(o)return o(t,!0);if(d&&"string"==typeof t)return d(t);var l=Error("Cannot find module '"+t+"'");throw l.code="MODULE_NOT_FOUND",l}f.resolve=function(i){var n=e[t][1][i];return null!=n?n:i},f.cache={};var c=u[t]=new h.Module(t);e[t][0].call(c.exports,f,c,c.exports,s)}return u[t].exports;function f(e){var t=f.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var i={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],r=e[2]||e[0],s=h(n);"*"===t?Object.keys(s).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(i,e)||Object.defineProperty(i,e,{enumerable:!0,get:function(){return s[e]}})}):"*"===r?Object.defineProperty(i,t,{enumerable:!0,value:s}):Object.defineProperty(i,t,{enumerable:!0,get:function(){return"default"===r?s.__esModule?s.default:s:s[r]}})}),i}return h(t)}}h.isParcelRequire=!0,h.Module=function(e){this.id=e,this.bundle=h,this.require=d,this.exports={}},h.modules=e,h.cache=u,h.parent=o,h.distDir=void 0,h.publicUrl=void 0,h.devServer=void 0,h.i=a,h.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(h,"root",{get:function(){return s[n]}}),s[n]=h;for(var l=0;l<t.length;l++)h(t[l]);if(i){var c=h(i);"object"==typeof exports&&"u">typeof module?module.exports=c:"function"==typeof define&&define.amd&&define(function(){return c})}}({dwHLV:[function(e,t,i,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(i),r.export(i,"default",()=>o);var s=e("@glomex/vast-ima-player");function o(e){return async t=>{let{template:i,constructor:n}=t,{createElement:r,setStyles:o}=n.utils,{$video:a,$player:u}=i;await (0,s.loadImaSdk)();let d=window.google.ima,h=new d.AdsRenderingSettings;h.restoreCustomPlaybackStateOnAdBreakComplete=!0,h.enablePreloading=!0;let l=new(0,s.PlayerOptions),c=!1,f=null,p=null;function v(){let e;return f?f:((e=r("div")).id=`art-vast-${Date.now()}`,o(e,{position:"absolute",inset:"0",width:"100%",height:"100%",zIndex:"150",backgroundColor:"black",display:"none",pointerEvents:"auto"}),p=e,u.appendChild(p),(f=new(0,s.Player)(d,a,p,h,l)).addEventListener("AdContentPauseRequested",()=>{c=!0,p.style.display="block"}),f.addEventListener("AdContentResumeRequested",()=>{c=!1,p.style.display="none"}),f.addEventListener("AdStarted",()=>{c=!0,p.style.display="block"}),f.addEventListener("AdError",e=>{console.error("VAST Ad Error:",e.detail),c=!1,p.style.display="none"}),f)}return"function"==typeof e&&await e({art:t,playUrl:function(e,t={}){if(c)return;f||v();let i=new d.AdsRequest;for(let n in i.adTagUrl=e,t)i[n]=t[n];f.playAds(i)},playRes:function(e,t={}){if(c)return;f||v();let i=new d.AdsRequest;for(let n in i.adsResponse=e,t)i[n]=t[n];f.playAds(i)},init:v,ima:d,adsRenderingSettings:h,playerOptions:l,get imaPlayer(){return f},get container(){return p}}),{name:"artplayerPluginVast",destroy:function(){f?.destroy&&f.destroy(),p?.parentNode&&p.parentNode.removeChild(p),p=null,f=null}}}}"u">typeof window&&(window.artplayerPluginVast=o)},{"@glomex/vast-ima-player":"edhqb","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],edhqb:[function(e,t,i,n){var r,s,o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(i),o.export(i,"Player",()=>ed),o.export(i,"PlayerError",()=>j),o.export(i,"PlayerEvent",()=>M),o.export(i,"PlayerOptions",()=>L),o.export(i,"loadImaSdk",()=>d);var a=null,u=function(){a=null},d=function(){var e=window;return e.google&&e.google.ima?Promise.resolve(e.google.ima):a||((a=new Promise(function(e,t){var i=document.createElement("script");i.async=!0,i.src="https://imasdk.googleapis.com/js/sdkloader/ima3.js",i.onload=e,i.onerror=t,document.body.appendChild(i)}).then(function(){return e.google.ima})).then(u).catch(u),a)};function h(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function l(e,t,i){return t&&h(e.prototype,t),i&&h(e,i),e}function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}function f(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,v(e,t)}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e,t,i){return(y=!function(){if("u"<typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof ProxyLine truncated
|
||||
!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.ArtplayerPluginVast=e(),define(function(){return t.ArtplayerPluginVast})):(t="undefined"!==typeof globalThis?globalThis:t||self).ArtplayerPluginVast=e()}(this,function(){"use strict";var t=null,e=function(){t=null};function i(t,e,i){return e&&function(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}(t.prototype,e),t}function n(){return n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},n.apply(this,arguments)}function s(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,o(t,e)}function r(t){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t,e,i){return(a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}()?Reflect.construct:function(t,e,i){var n=[null];n.push.apply(n,e);var s=new(Function.bind.apply(t,n));return i&&o(s,i.prototype),s}).apply(null,arguments)}function d(t){var e="function"==typeof Map?new Map:void 0;return d=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,i)}function i(){return a(t,arguments,r(this).constructor)}return i.prototype=Object.create(t.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),o(i,t)},d(t)}function h(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}var l=0;function c(t){return"__private_"+l+++"_"+t}function f(t,e){if(!Object.prototype.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var p={};p.CustomEvent="function"==typeof CustomEvent?CustomEvent:function(t){return e[t]=new e("").constructor[t],e;function e(t,e){e||(e={});var i=document.createEvent("CustomEvent");return i.initCustomEvent(t,!!e.bubbles,!!e.cancelable,e.detail),i}}("prototype");var v,E,y,A=p.CustomEvent,m=c("mediaElement"),b=c("currentTime"),g=c("enabled"),O=function(){function t(t){Object.defineProperty(this,m,{writable:!0,value:void 0}),Object.defineProperty(this,b,{writable:!0,value:void 0}),Object.defineProperty(this,g,{writable:!0,value:void 0}),this.seeking=void 0,f(this,m)[m]=t,f(this,b)[b]=0,f(this,g)[g]=!1,this.seeking=!1,this.t=this.t.bind(this),this.i=this.i.bind(this),this.h=this.h.bind(this),this.enable()}var e=t.prototype;return e.i=function(){this.seeking=!0},e.h=function(){this.seeking=!1},e.t=function(){var t,e;this.seeking||null!=(t=f(this,m)[m])&&t.paused||(f(this,b)[b]=null==(e=f(this,m)[m])?void 0:e.currentTime)},e.enable=function(){var t,e,i;f(this,g)[g]||(null==(t=f(this,m)[m])||t.addEventListener("seeking",this.i),null==(e=f(this,m)[m])||e.addEventListener("seeked",this.h),null==(i=f(this,m)[m])||i.addEventListener("timeupdate",this.t),f(this,g)[g]=!0)},e.disable=function(){var t,e,i;f(this,g)[g]&&(null==(t=f(this,m)[m])||t.removeEventListener("seeking",this.i),null==(e=f(this,m)[m])||e.removeEventListener("seeked",this.h),null==(i=f(this,m)[m])||i.removeEventListener("timeupdate",this.t),f(this,g)[g]=!1)},e.play=function(){var t=this;return new Promise(function(e){var i;e(null==(i=f(t,m)[m])?void 0:i.play())})},e.pause=function(){var t;null==(t=f(this,m)[m])||t.pause()},e.reset=function(){f(this,b)[b]=0,f(this,g)[g]=!1,this.seeking=!1,this.enable()},e.destroy=function(){f(this,b)[b]=0,f(this,g)[g]=!1,this.seeking=!1,this.disable(),f(this,m)[m]=void 0},i(t,[{key:"enabled",get:function(){return f(this,g)[g]}},{key:"currentTime",get:function(){return f(this,b)[b]}},{key:"duration",get:function(){var t;return null==(t=f(this,m)[m])?void 0:t.duration}},{key:"muted",get:function(){var t;return null==(t=f(this,m)[m])?void 0:t.muted}},{key:"volume",get:function(){var t;return null==(t=f(this,m)[m])?void 0:t.volume}}]),t}(),w=function(){function t(){this.delegate=document.createDocumentFragment()}var e=t.prototype;return e.addEventListener=function(){this.delegate.addEventListener.apply(this.delegate,[].slice.call(arguments))},e.dispatchEvent=function(){return this.delegate.dispatchEvent.apply(this.delegate,[].slice.call(arguments))},e.removeEventListener=function(){return this.delegate.removeEventListener.apply(this.delegate,[].slicLine truncated
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-vast.js v1.1.0
|
||||
* artplayer-plugin-vast.js v1.1.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,i,n,r){var s="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},o="function"==typeof s[n]&&s[n],a=o.i||{},u=o.cache||{},l="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,i){if(!u[t]){if(!e[t]){if(r[t])return r[t];var a="function"==typeof s[n]&&s[n];if(!i&&a)return a(t,!0);if(o)return o(t,!0);if(l&&"string"==typeof t)return l(t);var h=Error("Cannot find module '"+t+"'");throw h.code="MODULE_NOT_FOUND",h}f.resolve=function(i){var n=e[t][1][i];return null!=n?n:i},f.cache={};var c=u[t]=new d.Module(t);e[t][0].call(c.exports,f,c,c.exports,s)}return u[t].exports;function f(e){var t=f.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var i={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],r=e[2]||e[0],s=d(n);"*"===t?Object.keys(s).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(i,e)||Object.defineProperty(i,e,{enumerable:!0,get:function(){return s[e]}})}):"*"===r?Object.defineProperty(i,t,{enumerable:!0,value:s}):Object.defineProperty(i,t,{enumerable:!0,get:function(){return"default"===r?s.__esModule?s.default:s:s[r]}})}),i}return d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.require=l,this.exports={}},d.modules=e,d.cache=u,d.parent=o,d.distDir=void 0,d.publicUrl=void 0,d.devServer=void 0,d.i=a,d.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(d,"root",{get:function(){return s[n]}}),s[n]=d;for(var h=0;h<t.length;h++)d(t[h]);if(i){var c=d(i);"object"==typeof exports&&"u">typeof module?module.exports=c:"function"==typeof define&&define.amd&&define(function(){return c})}}({bxP13:[function(e,t,i,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(i),r.export(i,"default",function(){return u});var s=e("@swc/helpers/cjs/_async_to_generator.cjs"),o=e("@swc/helpers/cjs/_ts_generator.cjs"),a=e("@glomex/vast-ima-player");function u(e){return function(t){return(0,s._)(function(){var i,n,r,s,u,l,d,h,c,f,p,v;function y(){var e;return p?p:((e=r("div")).id="art-vast-".concat(Date.now()),s(e,{position:"absolute",inset:"0",width:"100%",height:"100%",zIndex:"150",backgroundColor:"black",display:"none",pointerEvents:"auto"}),v=e,l.appendChild(v),(p=new(0,a.Player)(d,u,v,h,c)).addEventListener("AdContentPauseRequested",function(){f=!0,v.style.display="block"}),p.addEventListener("AdContentResumeRequested",function(){f=!1,v.style.display="none"}),p.addEventListener("AdStarted",function(){f=!0,v.style.display="block"}),p.addEventListener("AdError",function(e){console.error("VAST Ad Error:",e.detail),f=!1,v.style.display="none"}),p)}function E(){(null==p?void 0:p.destroy)&&p.destroy(),(null==v?void 0:v.parentNode)&&v.parentNode.removeChild(v),v=null,p=null}function b(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!f){p||y();var i=new d.AdsRequest;for(var n in i.adTagUrl=e,t)i[n]=t[n];p.playAds(i)}}function m(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!f){p||y();var i=new d.AdsRequest;for(var n in i.adsResponse=e,t)i[n]=t[n];p.playAds(i)}}return(0,o._)(this,function(o){switch(o.label){case 0:return i=t.template,r=(n=t.constructor.utils).createElement,s=n.setStyles,u=i.$video,l=i.$player,[4,(0,a.loadImaSdk)()];case 1:if(o.sent(),(h=new(d=window.google.ima).AdsRenderingSettings).restoreCustomPlaybackStateOnAdBreakComplete=!0,h.enablePreloading=!0,c=new(0,a.PlayerOptions),f=!1,p=null,v=null,"function"!=typeof e)return[3,3];return[4,e({art:t,playUrl:b,playRes:m,init:y,ima:d,adsRenderingSettings:h,playerOptions:c,get imaPlayer(){return p},get container(){return v}})];case 2:o.sent(),o.label=3;case 3:return[2,{name:"artplayerPluginVast",destroy:E}]}})})()}}"u">typeof window&&(window.artplayerPluginVast=u)},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","@glomex/vast-ima-player":"f25He","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],cZn0e:[function(e,t,i,n){"use strict";function r(e,t,i,n,r,s,o){try{var a=e[s](o),u=a.value}catch(e){i(e);return}a.done?t(u):Promise.resolve(u).then(n,r)}i._=function(e){return function(){var t=this,i=arguments;return new Promise(function(n,s){var o=e.apply(t,i);function a(e){r(o,n,s,a,u,"next",e)}function u(e){r(o,n,s,a,u,"throw",e)}a(void 0)})}}},{}],eltGh:[function(e,t,i,n){"use strict";i._=function(e,t){var i,n,r,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(o,"next",{value:u(0)}),a(o,"throw",{value:u(1)}),a(o,"return",{value:u(2)}),"function"==typeof Symbol&&a(o,Symbol.iterator,{value:function(){return this}}),o;function u(a){return function(u){var l=[a,u];if(i)throw TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(s=0)),s;)try{if(i=1,n&&(r=2&l[0]?n.return:l[0]?n.throw||((r=n.return)&&r.cLine truncated
|
||||
!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.ArtplayerPluginVast=e(),define(function(){return t.ArtplayerPluginVast})):(t="undefined"!==typeof globalThis?globalThis:t||self).ArtplayerPluginVast=e()}(this,function(){"use strict";var t=null,e=function(){t=null};function i(t,e,i){return e&&function(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}(t.prototype,e),t}function n(){return n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},n.apply(this,arguments)}function s(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,o(t,e)}function r(t){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t,e,i){return(a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}()?Reflect.construct:function(t,e,i){var n=[null];n.push.apply(n,e);var s=new(Function.bind.apply(t,n));return i&&o(s,i.prototype),s}).apply(null,arguments)}function d(t){var e="function"==typeof Map?new Map:void 0;return d=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,i)}function i(){return a(t,arguments,r(this).constructor)}return i.prototype=Object.create(t.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),o(i,t)},d(t)}function h(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}var l=0;function c(t){return"__private_"+l+++"_"+t}function f(t,e){if(!Object.prototype.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var v={};v.CustomEvent="function"==typeof CustomEvent?CustomEvent:function(t){return e[t]=new e("").constructor[t],e;function e(t,e){e||(e={});var i=document.createEvent("CustomEvent");return i.initCustomEvent(t,!!e.bubbles,!!e.cancelable,e.detail),i}}("prototype");var p,y,E,A=v.CustomEvent,m=c("mediaElement"),b=c("currentTime"),g=c("enabled"),O=function(){function t(t){Object.defineProperty(this,m,{writable:!0,value:void 0}),Object.defineProperty(this,b,{writable:!0,value:void 0}),Object.defineProperty(this,g,{writable:!0,value:void 0}),this.seeking=void 0,f(this,m)[m]=t,f(this,b)[b]=0,f(this,g)[g]=!1,this.seeking=!1,this.t=this.t.bind(this),this.i=this.i.bind(this),this.h=this.h.bind(this),this.enable()}var e=t.prototype;return e.i=function(){this.seeking=!0},e.h=function(){this.seeking=!1},e.t=function(){var t,e;this.seeking||null!=(t=f(this,m)[m])&&t.paused||(f(this,b)[b]=null==(e=f(this,m)[m])?void 0:e.currentTime)},e.enable=function(){var t,e,i;f(this,g)[g]||(null==(t=f(this,m)[m])||t.addEventListener("seeking",this.i),null==(e=f(this,m)[m])||e.addEventListener("seeked",this.h),null==(i=f(this,m)[m])||i.addEventListener("timeupdate",this.t),f(this,g)[g]=!0)},e.disable=function(){var t,e,i;f(this,g)[g]&&(null==(t=f(this,m)[m])||t.removeEventListener("seeking",this.i),null==(e=f(this,m)[m])||e.removeEventListener("seeked",this.h),null==(i=f(this,m)[m])||i.removeEventListener("timeupdate",this.t),f(this,g)[g]=!1)},e.play=function(){var t=this;return new Promise(function(e){var i;e(null==(i=f(t,m)[m])?void 0:i.play())})},e.pause=function(){var t;null==(t=f(this,m)[m])||t.pause()},e.reset=function(){f(this,b)[b]=0,f(this,g)[g]=!1,this.seeking=!1,this.enable()},e.destroy=function(){f(this,b)[b]=0,f(this,g)[g]=!1,this.seeking=!1,this.disable(),f(this,m)[m]=void 0},i(t,[{key:"enabled",get:function(){return f(this,g)[g]}},{key:"currentTime",get:function(){return f(this,b)[b]}},{key:"duration",get:function(){var t;return null==(t=f(this,m)[m])?void 0:t.duration}},{key:"muted",get:function(){var t;return null==(t=f(this,m)[m])?void 0:t.muted}},{key:"volume",get:function(){var t;return null==(t=f(this,m)[m])?void 0:t.volume}}]),t}(),w=function(){function t(){this.delegate=document.createDocumentFragment()}var e=t.prototype;return e.addEventListener=function(){this.delegate.addEventListener.apply(this.delegate,[].slice.call(arguments))},e.dispatchEvent=function(){return this.delegate.dispatchEvent.apply(this.delegate,[].slice.call(arguments))},e.removeEventListener=function(){return this.delegate.removeEventListener.apply(this.delegate,[].slicLine truncated
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-vast.js v1.1.0
|
||||
* artplayer-plugin-vast.js v1.1.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,i,n,r){var s="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},o="function"==typeof s[n]&&s[n],a=o.i||{},u=o.cache||{},d="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function l(t,i){if(!u[t]){if(!e[t]){if(r[t])return r[t];var a="function"==typeof s[n]&&s[n];if(!i&&a)return a(t,!0);if(o)return o(t,!0);if(d&&"string"==typeof t)return d(t);var h=Error("Cannot find module '"+t+"'");throw h.code="MODULE_NOT_FOUND",h}f.resolve=function(i){var n=e[t][1][i];return null!=n?n:i},f.cache={};var c=u[t]=new l.Module(t);e[t][0].call(c.exports,f,c,c.exports,s)}return u[t].exports;function f(e){var t=f.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var i={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],r=e[2]||e[0],s=l(n);"*"===t?Object.keys(s).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(i,e)||Object.defineProperty(i,e,{enumerable:!0,get:function(){return s[e]}})}):"*"===r?Object.defineProperty(i,t,{enumerable:!0,value:s}):Object.defineProperty(i,t,{enumerable:!0,get:function(){return"default"===r?s.__esModule?s.default:s:s[r]}})}),i}return l(t)}}l.isParcelRequire=!0,l.Module=function(e){this.id=e,this.bundle=l,this.require=d,this.exports={}},l.modules=e,l.cache=u,l.parent=o,l.distDir=void 0,l.publicUrl=void 0,l.devServer=void 0,l.i=a,l.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(l,"root",{get:function(){return s[n]}}),s[n]=l;for(var h=0;h<t.length;h++)l(t[h]);if(i){var c=l(i);"object"==typeof exports&&"u">typeof module?module.exports=c:"function"==typeof define&&define.amd&&define(function(){return c})}}({cVeZd:[function(e,t,i,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(i),r.export(i,"default",()=>o);var s=e("@glomex/vast-ima-player");function o(e){return async t=>{let{template:i,constructor:n}=t,{createElement:r,setStyles:o}=n.utils,{$video:a,$player:u}=i;await (0,s.loadImaSdk)();let d=window.google.ima,l=new d.AdsRenderingSettings;l.restoreCustomPlaybackStateOnAdBreakComplete=!0,l.enablePreloading=!0;let h=new(0,s.PlayerOptions),c=!1,f=null,p=null;function v(){let e;return f?f:((e=r("div")).id=`art-vast-${Date.now()}`,o(e,{position:"absolute",inset:"0",width:"100%",height:"100%",zIndex:"150",backgroundColor:"black",display:"none",pointerEvents:"auto"}),p=e,u.appendChild(p),(f=new(0,s.Player)(d,a,p,l,h)).addEventListener("AdContentPauseRequested",()=>{c=!0,p.style.display="block"}),f.addEventListener("AdContentResumeRequested",()=>{c=!1,p.style.display="none"}),f.addEventListener("AdStarted",()=>{c=!0,p.style.display="block"}),f.addEventListener("AdError",e=>{console.error("VAST Ad Error:",e.detail),c=!1,p.style.display="none"}),f)}return"function"==typeof e&&await e({art:t,playUrl:function(e,t={}){if(c)return;f||v();let i=new d.AdsRequest;for(let n in i.adTagUrl=e,t)i[n]=t[n];f.playAds(i)},playRes:function(e,t={}){if(c)return;f||v();let i=new d.AdsRequest;for(let n in i.adsResponse=e,t)i[n]=t[n];f.playAds(i)},init:v,ima:d,adsRenderingSettings:l,playerOptions:h,get imaPlayer(){return f},get container(){return p}}),{name:"artplayerPluginVast",destroy:function(){f?.destroy&&f.destroy(),p?.parentNode&&p.parentNode.removeChild(p),p=null,f=null}}}}"u">typeof window&&(window.artplayerPluginVast=o)},{"@glomex/vast-ima-player":"1iE81","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],"1iE81":[function(e,t,i,n){var r,s,o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(i),o.export(i,"Player",()=>ed),o.export(i,"PlayerError",()=>L),o.export(i,"PlayerEvent",()=>M),o.export(i,"PlayerOptions",()=>j),o.export(i,"loadImaSdk",()=>d);var a=null,u=function(){a=null},d=function(){var e=window;return e.google&&e.google.ima?Promise.resolve(e.google.ima):a||((a=new Promise(function(e,t){var i=document.createElement("script");i.async=!0,i.src="https://imasdk.googleapis.com/js/sdkloader/ima3.js",i.onload=e,i.onerror=t,document.body.appendChild(i)}).then(function(){return e.google.ima})).then(u).catch(u),a)};function l(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function h(e,t,i){return t&&l(e.prototype,t),i&&l(e,i),e}function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}function f(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,v(e,t)}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e,t,i){return(y=!function(){if("u"<typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof ProLine truncated
|
||||
var t=null,e=function(){t=null};function i(t,e,i){return e&&function(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}(t.prototype,e),t}function n(){return n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},n.apply(this,arguments)}function s(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,o(t,e)}function r(t){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t,e,i){return(a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}()?Reflect.construct:function(t,e,i){var n=[null];n.push.apply(n,e);var s=new(Function.bind.apply(t,n));return i&&o(s,i.prototype),s}).apply(null,arguments)}function d(t){var e="function"==typeof Map?/* @__PURE__ */new Map:void 0;return d=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,i)}function i(){return a(t,arguments,r(this).constructor)}return i.prototype=Object.create(t.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),o(i,t)},d(t)}function h(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}var l=0;function c(t){return"__private_"+l+++"_"+t}function v(t,e){if(!Object.prototype.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var f={};f.CustomEvent="function"==typeof CustomEvent?CustomEvent:function(t){return e[t]=new e("").constructor[t],e;function e(t,e){e||(e={});var i=document.createEvent("CustomEvent");return i.initCustomEvent(t,!!e.bubbles,!!e.cancelable,e.detail),i}}("prototype");var p,E,y,A=f.CustomEvent,m=c("mediaElement"),b=c("currentTime"),g=c("enabled"),O=function(){function t(t){Object.defineProperty(this,m,{writable:!0,value:void 0}),Object.defineProperty(this,b,{writable:!0,value:void 0}),Object.defineProperty(this,g,{writable:!0,value:void 0}),this.seeking=void 0,v(this,m)[m]=t,v(this,b)[b]=0,v(this,g)[g]=!1,this.seeking=!1,this.t=this.t.bind(this),this.i=this.i.bind(this),this.h=this.h.bind(this),this.enable()}var e=t.prototype;return e.i=function(){this.seeking=!0},e.h=function(){this.seeking=!1},e.t=function(){var t,e;this.seeking||null!=(t=v(this,m)[m])&&t.paused||(v(this,b)[b]=null==(e=v(this,m)[m])?void 0:e.currentTime)},e.enable=function(){var t,e,i;v(this,g)[g]||(null==(t=v(this,m)[m])||t.addEventListener("seeking",this.i),null==(e=v(this,m)[m])||e.addEventListener("seeked",this.h),null==(i=v(this,m)[m])||i.addEventListener("timeupdate",this.t),v(this,g)[g]=!0)},e.disable=function(){var t,e,i;v(this,g)[g]&&(null==(t=v(this,m)[m])||t.removeEventListener("seeking",this.i),null==(e=v(this,m)[m])||e.removeEventListener("seeked",this.h),null==(i=v(this,m)[m])||i.removeEventListener("timeupdate",this.t),v(this,g)[g]=!1)},e.play=function(){var t=this;return new Promise(function(e){var i;e(null==(i=v(t,m)[m])?void 0:i.play())})},e.pause=function(){var t;null==(t=v(this,m)[m])||t.pause()},e.reset=function(){v(this,b)[b]=0,v(this,g)[g]=!1,this.seeking=!1,this.enable()},e.destroy=function(){v(this,b)[b]=0,v(this,g)[g]=!1,this.seeking=!1,this.disable(),v(this,m)[m]=void 0},i(t,[{key:"enabled",get:function(){return v(this,g)[g]}},{key:"currentTime",get:function(){return v(this,b)[b]}},{key:"duration",get:function(){var t;return null==(t=v(this,m)[m])?void 0:t.duration}},{key:"muted",get:function(){var t;return null==(t=v(this,m)[m])?void 0:t.muted}},{key:"volume",get:function(){var t;return null==(t=v(this,m)[m])?void 0:t.volume}}]),t}(),w=function(){function t(){this.delegate=document.createDocumentFragment()}var e=t.prototype;return e.addEventListener=function(){this.delegate.addEventListener.apply(this.delegate,[].slice.call(arguments))},e.dispatchEvent=function(){return this.delegate.dispatchEvent.apply(this.delegate,[].slice.call(arguments))},e.removeEventListener=function(){return this.delegate.removeEventListener.apply(this.delegate,[].slice.call(arguments))},t}(),R=["abort","canplay","canplaythrough","durationchange","emptied","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"];(y=p||(p={})).MEDIA_STALine truncated
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "artplayer-plugin-vast",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.1",
|
||||
"description": "VAST plugin for ArtPlayer",
|
||||
"author": "Harvey Zhao <laozhaochaguan@gmail.com>",
|
||||
"license": "MIT",
|
||||
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-vtt-thumbnail.js v1.0.3
|
||||
* artplayer-plugin-vtt-thumbnail.js v1.0.4
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,n,o){var l="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},i="function"==typeof l[n]&&l[n],u=i.i||{},a=i.cache||{},f="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,r){if(!a[t]){if(!e[t]){if(o[t])return o[t];var u="function"==typeof l[n]&&l[n];if(!r&&u)return u(t,!0);if(i)return i(t,!0);if(f&&"string"==typeof t)return f(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}p.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},p.cache={};var c=a[t]=new d.Module(t);e[t][0].call(c.exports,p,c,c.exports,l)}return a[t].exports;function p(e){var t=p.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],l=d(n);"*"===t?Object.keys(l).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return l[e]}})}):"*"===o?Object.defineProperty(r,t,{enumerable:!0,value:l}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===o?l.__esModule?l.default:l:l[o]}})}),r}return d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.require=f,this.exports={}},d.modules=e,d.cache=a,d.parent=i,d.distDir=void 0,d.publicUrl=void 0,d.devServer=void 0,d.i=u,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 s=0;s<t.length;s++)d(t[s]);if(r){var c=d(r);"object"==typeof exports&&"u">typeof module?module.exports=c:"function"==typeof define&&define.amd&&define(function(){return c})}}({dNMrC:[function(e,t,r,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"default",()=>u);var l=e("./getVttArray"),i=o.interopDefault(l);function u(e){return async t=>{let{constructor:{utils:{setStyle:r,isMobile:n,addClass:o}},template:{$progress:l}}=t,u=null,a=await (0,i.default)(e.vtt);return t.controls.add({name:"vtt-thumbnail",position:"top",index:20,style:e.style||{},mounted(e){o(e,"art-control-thumbnails"),t.on("setBar",async(o,i,f)=>{let d="played"===o&&f&&n;if("hover"===o||d){let o=l.clientWidth*i,f=i*t.duration;r(e,"display","flex");let s=a.find(e=>f>=e.start&&f<=e.end);if(!s)return r(e,"display","none");if(o>0&&o<l.clientWidth)r(e,"backgroundImage",`url(${s.url})`),r(e,"height",`${s.h}px`),r(e,"width",`${s.w}px`),r(e,"backgroundPosition",`-${s.x}px -${s.y}px`),o<=s.w/2?r(e,"left",0):o>l.clientWidth-s.w/2?r(e,"left",`${l.clientWidth-s.w}px`):r(e,"left",`${o-s.w/2}px`);else n||r(e,"display","none");d&&(clearTimeout(u),u=setTimeout(()=>{r(e,"display","none")},500))}})}}),{name:"artplayerPluginVttThumbnail"}}}"u">typeof window&&(window.artplayerPluginVttThumbnail=u)},{"./getVttArray":"53JTS","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"53JTS":[function(e,t,r,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");function l(e){var t,r,n;let o=e.split("."),l=o[0].split(":")||[],i=Number((t=o[1]||"0",r=3,n="0",t.length>r?String(t):((r-=t.length)>n.length&&(n+=n.repeat(r/n.length)),String(t)+n.slice(0,r))))/1e3;return 3600*Number(l[l.length-3]||0)+60*Number(l[l.length-2]||0)+Number(l[l.length-1]||0)+i}async function i(e=""){let t=(await (await fetch(e)).text()).split(/[\n\r]/g).filter(e=>e.trim()),r=[];for(let n=1;n<t.length;n+=2){let o=t[n],i=t[n+1];if(!i.trim())continue;let u=/((?:\d{2}:)?(?:\d{2}:)?\d{2}(?:.\d{3})?) ?-->?((?:\d{2}:)?(?:\d{2}:)?\d{2}(?:.\d{3})?)/,a=o.match(u),f=/(.*)#(\w{4})=(.*)/,d=i.match(f),s=Math.floor(l(a[1])),c=Math.floor(l(a[2])),p=d[1];if(!/^\/|(?:https?|ftp|file):\/\//i.test(p)){let t=e.split("/");t.pop(),t.push(p),p=t.join("/")}let h={start:s,end:c,url:p},y=d[2].split(""),m=d[3].split(",");for(let e=0;e<y.length;e++)h[y[e]]=m[e];r.push(h)}return r}o.defineInteropFlag(r),o.export(r,"default",()=>i)},{"@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"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})}},{}]},["dNMrC"],"dNMrC","parcelRequire4dc0",{});
|
||||
!function(t,n){"object"===typeof exports&&"undefined"!==typeof module?module.exports=n():"function"==typeof define&&define.amd?(t.ArtplayerPluginVttThumbnail=n(),define(function(){return t.ArtplayerPluginVttThumbnail})):(t="undefined"!==typeof globalThis?globalThis:t||self).ArtplayerPluginVttThumbnail=n()}(this,function(){"use strict";function t(t){const n=t.split("."),e=n[0].split(":")||[],i=(l=n[1]||"0",o=3,s="0",l.length>o?String(l):((o-=l.length)>s.length&&(s+=s.repeat(o/s.length)),String(l)+s.slice(0,o)));var l,o,s;const r=Number(i)/1e3;return 3600*Number(e[e.length-3]||0)+60*Number(e[e.length-2]||0)+Number(e[e.length-1]||0)+r}function n(n){return async e=>{const{constructor:{utils:{setStyle:i,isMobile:l,addClass:o}},template:{$progress:s}}=e;let r=null;const a=await async function(n=""){const e=(await(await fetch(n)).text()).split(/[\n\r]/g).filter(t=>t.trim()),i=[];for(let l=1;l<e.length;l+=2){const o=e[l],s=e[l+1];if(!s.trim())continue;const r=/((?:\d{2}:)?(?:\d{2}:)?\d{2}(?:.\d{3})?) ?--> ?((?:\d{2}:)?(?:\d{2}:)?\d{2}(?:.\d{3})?)/,a=o.match(r),u=/(.*)#(\w{4})=(.*)/,d=s.match(u),c=Math.floor(t(a[1])),p=Math.floor(t(a[2]));let f=d[1];if(!/^\/|(?:https?|ftp|file):\/\//i.test(f)){const t=n.split("/");t.pop(),t.push(f),f=t.join("/")}const h={start:c,end:p,url:f},m=d[2].split(""),g=d[3].split(",");for(let t=0;t<m.length;t++)h[m[t]]=g[t];i.push(h)}return i}(n.vtt);return e.controls.add({name:"vtt-thumbnail",position:"top",index:20,style:n.style||{},mounted(t){o(t,"art-control-thumbnails"),e.on("setBar",async(n,o,u)=>{const d="played"===n&&u&&l;if("hover"===n||d){const n=s.clientWidth*o,u=o*e.duration;i(t,"display","flex");const c=a.find(t=>u>=t.start&&u<=t.end);if(!c)return i(t,"display","none");n>0&&n<s.clientWidth?function(t,n,e){i(t,"backgroundImage",`url(${n.url})`),i(t,"height",`${n.h}px`),i(t,"width",`${n.w}px`),i(t,"backgroundPosition",`-${n.x}px -${n.y}px`),e<=n.w/2?i(t,"left",0):e>s.clientWidth-n.w/2?i(t,"left",s.clientWidth-n.w+"px"):i(t,"left",e-n.w/2+"px")}(t,c,n):l||i(t,"display","none"),d&&(clearTimeout(r),r=setTimeout(()=>{i(t,"display","none")},500))}})}}),{name:"artplayerPluginVttThumbnail"}}}return"undefined"!==typeof window&&(window.artplayerPluginVttThumbnail=n),n});
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-vtt-thumbnail.js v1.0.3
|
||||
* artplayer-plugin-vtt-thumbnail.js v1.0.4
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,n,o){var u="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},i="function"==typeof u[n]&&u[n],l=i.i||{},c=i.cache||{},a="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function s(t,r){if(!c[t]){if(!e[t]){if(o[t])return o[t];var l="function"==typeof u[n]&&u[n];if(!r&&l)return l(t,!0);if(i)return i(t,!0);if(a&&"string"==typeof t)return a(t);var f=Error("Cannot find module '"+t+"'");throw f.code="MODULE_NOT_FOUND",f}d.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},d.cache={};var p=c[t]=new s.Module(t);e[t][0].call(p.exports,d,p,p.exports,u)}return c[t].exports;function d(e){var t=d.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=s(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 s(t)}}s.isParcelRequire=!0,s.Module=function(e){this.id=e,this.bundle=s,this.require=a,this.exports={}},s.modules=e,s.cache=c,s.parent=i,s.distDir=void 0,s.publicUrl=void 0,s.devServer=void 0,s.i=l,s.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(s,"root",{get:function(){return u[n]}}),u[n]=s;for(var f=0;f<t.length;f++)s(t[f]);if(r){var p=s(r);"object"==typeof exports&&"u">typeof module?module.exports=p:"function"==typeof define&&define.amd&&define(function(){return p})}}({gJaKg:[function(e,t,r,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"default",function(){return a});var u=e("@swc/helpers/cjs/_async_to_generator.cjs"),i=e("@swc/helpers/cjs/_ts_generator.cjs"),l=e("./getVttArray"),c=o.interopDefault(l);function a(e){return function(t){return(0,u._)(function(){var r,n,o,l,a,s,f;return(0,i._)(this,function(p){switch(p.label){case 0:return n=(r=t.constructor.utils).setStyle,o=r.isMobile,l=r.addClass,a=t.template.$progress,s=null,[4,(0,c.default)(e.vtt)];case 1:return f=p.sent(),t.controls.add({name:"vtt-thumbnail",position:"top",index:20,style:e.style||{},mounted:function(e){l(e,"art-control-thumbnails"),t.on("setBar",function(r,l,c){return(0,u._)(function(){var u,p,d,h;return(0,i._)(this,function(i){if(u="played"===r&&c&&o,"hover"===r||u){if(p=a.clientWidth*l,d=l*t.duration,n(e,"display","flex"),!(h=f.find(function(e){return d>=e.start&&d<=e.end})))return[2,n(e,"display","none")];if(p>0&&p<a.clientWidth)n(e,"backgroundImage","url(".concat(h.url,")")),n(e,"height","".concat(h.h,"px")),n(e,"width","".concat(h.w,"px")),n(e,"backgroundPosition","-".concat(h.x,"px -").concat(h.y,"px")),p<=h.w/2?n(e,"left",0):p>a.clientWidth-h.w/2?n(e,"left","".concat(a.clientWidth-h.w,"px")):n(e,"left","".concat(p-h.w/2,"px"));else o||n(e,"display","none");u&&(clearTimeout(s),s=setTimeout(function(){n(e,"display","none")},500))}return[2]})})()})}}),[2,{name:"artplayerPluginVttThumbnail"}]}})})()}}"u">typeof window&&(window.artplayerPluginVttThumbnail=a)},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","./getVttArray":"j5vq0","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],cZn0e:[function(e,t,r,n){"use strict";function o(e,t,r,n,o,u,i){try{var l=e[u](i),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}r._=function(e){return function(){var t=this,r=arguments;return new Promise(function(n,u){var i=e.apply(t,r);function l(e){o(i,n,u,l,c,"next",e)}function c(e){o(i,n,u,l,c,"throw",e)}l(void 0)})}}},{}],eltGh:[function(e,t,r,n){"use strict";r._=function(e,t){var r,n,o,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:c(0)}),l(i,"throw",{value:c(1)}),l(i,"return",{value:c(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function c(l){return function(c){var a=[l,c];if(r)throw TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,n=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])thLine truncated
|
||||
!function(t,n){"object"===typeof exports&&"undefined"!==typeof module?module.exports=n():"function"==typeof define&&define.amd?(t.ArtplayerPluginVttThumbnail=n(),define(function(){return t.ArtplayerPluginVttThumbnail})):(t="undefined"!==typeof globalThis?globalThis:t||self).ArtplayerPluginVttThumbnail=n()}(this,function(){"use strict";var t=(t,n,e)=>new Promise((l,i)=>{var o=t=>{try{s(e.next(t))}catch(n){i(n)}},r=t=>{try{s(e.throw(t))}catch(n){i(n)}},s=t=>t.done?l(t.value):Promise.resolve(t.value).then(o,r);s((e=e.apply(t,n)).next())});function n(t){const n=t.split("."),e=n[0].split(":")||[],l=(i=n[1]||"0",o=3,r="0",i.length>o?String(i):((o-=i.length)>r.length&&(r+=r.repeat(o/r.length)),String(i)+r.slice(0,o)));var i,o,r;const s=Number(l)/1e3;return 3600*Number(e[e.length-3]||0)+60*Number(e[e.length-2]||0)+Number(e[e.length-1]||0)+s}function e(e){return l=>t(null,null,function*(){const{constructor:{utils:{setStyle:i,isMobile:o,addClass:r}},template:{$progress:s}}=l;let u=null;const d=yield function(e=""){return t(this,null,function*(){const t=(yield(yield fetch(e)).text()).split(/[\n\r]/g).filter(t=>t.trim()),l=[];for(let i=1;i<t.length;i+=2){const o=t[i],r=t[i+1];if(!r.trim())continue;const s=/((?:\d{2}:)?(?:\d{2}:)?\d{2}(?:.\d{3})?) ?--> ?((?:\d{2}:)?(?:\d{2}:)?\d{2}(?:.\d{3})?)/,u=o.match(s),d=/(.*)#(\w{4})=(.*)/,a=r.match(d),c=Math.floor(n(u[1])),p=Math.floor(n(u[2]));let f=a[1];if(!/^\/|(?:https?|ftp|file):\/\//i.test(f)){const t=e.split("/");t.pop(),t.push(f),f=t.join("/")}const h={start:c,end:p,url:f},m=a[2].split(""),y=a[3].split(",");for(let t=0;t<m.length;t++)h[m[t]]=y[t];l.push(h)}return l})}(e.vtt);return l.controls.add({name:"vtt-thumbnail",position:"top",index:20,style:e.style||{},mounted(n){r(n,"art-control-thumbnails"),l.on("setBar",(e,r,a)=>t(null,null,function*(){const t="played"===e&&a&&o;if("hover"===e||t){const e=s.clientWidth*r,a=r*l.duration;i(n,"display","flex");const c=d.find(t=>a>=t.start&&a<=t.end);if(!c)return i(n,"display","none");e>0&&e<s.clientWidth?function(t,n,e){i(t,"backgroundImage",`url(${n.url})`),i(t,"height",`${n.h}px`),i(t,"width",`${n.w}px`),i(t,"backgroundPosition",`-${n.x}px -${n.y}px`),e<=n.w/2?i(t,"left",0):e>s.clientWidth-n.w/2?i(t,"left",s.clientWidth-n.w+"px"):i(t,"left",e-n.w/2+"px")}(n,c,e):o||i(n,"display","none"),t&&(clearTimeout(u),u=setTimeout(()=>{i(n,"display","none")},500))}}))}}),{name:"artplayerPluginVttThumbnail"}})}return"undefined"!==typeof window&&(window.artplayerPluginVttThumbnail=e),e});
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-vtt-thumbnail.js v1.0.3
|
||||
* artplayer-plugin-vtt-thumbnail.js v1.0.4
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,n,o){var l="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},i="function"==typeof l[n]&&l[n],u=i.i||{},a=i.cache||{},f="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,r){if(!a[t]){if(!e[t]){if(o[t])return o[t];var u="function"==typeof l[n]&&l[n];if(!r&&u)return u(t,!0);if(i)return i(t,!0);if(f&&"string"==typeof t)return f(t);var d=Error("Cannot find module '"+t+"'");throw d.code="MODULE_NOT_FOUND",d}p.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},p.cache={};var s=a[t]=new c.Module(t);e[t][0].call(s.exports,p,s,s.exports,l)}return a[t].exports;function p(e){var t=p.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],l=c(n);"*"===t?Object.keys(l).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return l[e]}})}):"*"===o?Object.defineProperty(r,t,{enumerable:!0,value:l}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===o?l.__esModule?l.default:l:l[o]}})}),r}return c(t)}}c.isParcelRequire=!0,c.Module=function(e){this.id=e,this.bundle=c,this.require=f,this.exports={}},c.modules=e,c.cache=a,c.parent=i,c.distDir=void 0,c.publicUrl=void 0,c.devServer=void 0,c.i=u,c.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(c,"root",{get:function(){return l[n]}}),l[n]=c;for(var d=0;d<t.length;d++)c(t[d]);if(r){var s=c(r);"object"==typeof exports&&"u">typeof module?module.exports=s:"function"==typeof define&&define.amd&&define(function(){return s})}}({egVzc:[function(e,t,r,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"default",()=>u);var l=e("./getVttArray"),i=o.interopDefault(l);function u(e){return async t=>{let{constructor:{utils:{setStyle:r,isMobile:n,addClass:o}},template:{$progress:l}}=t,u=null,a=await (0,i.default)(e.vtt);return t.controls.add({name:"vtt-thumbnail",position:"top",index:20,style:e.style||{},mounted(e){o(e,"art-control-thumbnails"),t.on("setBar",async(o,i,f)=>{let c="played"===o&&f&&n;if("hover"===o||c){let o=l.clientWidth*i,f=i*t.duration;r(e,"display","flex");let d=a.find(e=>f>=e.start&&f<=e.end);if(!d)return r(e,"display","none");if(o>0&&o<l.clientWidth)r(e,"backgroundImage",`url(${d.url})`),r(e,"height",`${d.h}px`),r(e,"width",`${d.w}px`),r(e,"backgroundPosition",`-${d.x}px -${d.y}px`),o<=d.w/2?r(e,"left",0):o>l.clientWidth-d.w/2?r(e,"left",`${l.clientWidth-d.w}px`):r(e,"left",`${o-d.w/2}px`);else n||r(e,"display","none");c&&(clearTimeout(u),u=setTimeout(()=>{r(e,"display","none")},500))}})}}),{name:"artplayerPluginVttThumbnail"}}}"u">typeof window&&(window.artplayerPluginVttThumbnail=u)},{"./getVttArray":"i9qdo","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],i9qdo:[function(e,t,r,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");function l(e){var t,r,n;let o=e.split("."),l=o[0].split(":")||[],i=Number((t=o[1]||"0",r=3,n="0",t.length>r?String(t):((r-=t.length)>n.length&&(n+=n.repeat(r/n.length)),String(t)+n.slice(0,r))))/1e3;return 3600*Number(l[l.length-3]||0)+60*Number(l[l.length-2]||0)+Number(l[l.length-1]||0)+i}async function i(e=""){let t=(await (await fetch(e)).text()).split(/[\n\r]/g).filter(e=>e.trim()),r=[];for(let n=1;n<t.length;n+=2){let o=t[n],i=t[n+1];if(!i.trim())continue;let u=/((?:\d{2}:)?(?:\d{2}:)?\d{2}(?:.\d{3})?) ?-->?((?:\d{2}:)?(?:\d{2}:)?\d{2}(?:.\d{3})?)/,a=o.match(u),f=/(.*)#(\w{4})=(.*)/,c=i.match(f),d=Math.floor(l(a[1])),s=Math.floor(l(a[2])),p=c[1];if(!/^\/|(?:https?|ftp|file):\/\//i.test(p)){let t=e.split("/");t.pop(),t.push(p),p=t.join("/")}let h={start:d,end:s,url:p},y=c[2].split(""),m=c[3].split(",");for(let e=0;e<y.length;e++)h[y[e]]=m[e];r.push(h)}return r}o.defineInteropFlag(r),o.export(r,"default",()=>i)},{"@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})}},{}]},["egVzc"],"egVzc","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("egVzc");export{e as default};
|
||||
function t(t){const n=t.split("."),e=n[0].split(":")||[],i=(l=n[1]||"0",o=3,r="0",l.length>o?String(l):((o-=l.length)>r.length&&(r+=r.repeat(o/r.length)),String(l)+r.slice(0,o)));var l,o,r;const s=Number(i)/1e3;return 3600*Number(e[e.length-3]||0)+60*Number(e[e.length-2]||0)+Number(e[e.length-1]||0)+s}function n(n){return async e=>{const{constructor:{utils:{setStyle:i,isMobile:l,addClass:o}},template:{$progress:r}}=e;let s=null;const a=await async function(n=""){const e=(await(await fetch(n)).text()).split(/[\n\r]/g).filter(t=>t.trim()),i=[];for(let l=1;l<e.length;l+=2){const o=e[l],r=e[l+1];if(!r.trim())continue;const s=/((?:\d{2}:)?(?:\d{2}:)?\d{2}(?:.\d{3})?) ?--> ?((?:\d{2}:)?(?:\d{2}:)?\d{2}(?:.\d{3})?)/,a=o.match(s),u=/(.*)#(\w{4})=(.*)/,c=r.match(u),d=Math.floor(t(a[1])),p=Math.floor(t(a[2]));let h=c[1];if(!/^\/|(?:https?|ftp|file):\/\//i.test(h)){const t=n.split("/");t.pop(),t.push(h),h=t.join("/")}const f={start:d,end:p,url:h},g=c[2].split(""),m=c[3].split(",");for(let t=0;t<g.length;t++)f[g[t]]=m[t];i.push(f)}return i}(n.vtt);return e.controls.add({name:"vtt-thumbnail",position:"top",index:20,style:n.style||{},mounted(t){o(t,"art-control-thumbnails"),e.on("setBar",async(n,o,u)=>{const c="played"===n&&u&&l;if("hover"===n||c){const n=r.clientWidth*o,u=o*e.duration;i(t,"display","flex");const d=a.find(t=>u>=t.start&&u<=t.end);if(!d)return i(t,"display","none");n>0&&n<r.clientWidth?function(t,n,e){i(t,"backgroundImage",`url(${n.url})`),i(t,"height",`${n.h}px`),i(t,"width",`${n.w}px`),i(t,"backgroundPosition",`-${n.x}px -${n.y}px`),e<=n.w/2?i(t,"left",0):e>r.clientWidth-n.w/2?i(t,"left",r.clientWidth-n.w+"px"):i(t,"left",e-n.w/2+"px")}(t,d,n):l||i(t,"display","none"),c&&(clearTimeout(s),s=setTimeout(()=>{i(t,"display","none")},500))}})}}),{name:"artplayerPluginVttThumbnail"}}}"undefined"!==typeof window&&(window.artplayerPluginVttThumbnail=n);export{n as default};
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "artplayer-plugin-vtt-thumbnail",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"description": "vtt thumbnail plugin for ArtPlayer",
|
||||
"author": "Harvey Zhao <laozhaochaguan@gmail.com>",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-websr.js v1.0.0
|
||||
* artplayer-plugin-websr.js v1.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,i,s){var a="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},o="function"==typeof a[i]&&a[i],n=o.i||{},l=o.cache||{},d="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(t,r){if(!l[t]){if(!e[t]){if(s[t])return s[t];var n="function"==typeof a[i]&&a[i];if(!r&&n)return n(t,!0);if(o)return o(t,!0);if(d&&"string"==typeof t)return d(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}h.resolve=function(r){var i=e[t][1][r];return null!=i?i:r},h.cache={};var m=l[t]=new u.Module(t);e[t][0].call(m.exports,h,m,m.exports,a)}return l[t].exports;function h(e){var t=h.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],i=e[1],s=e[2]||e[0],a=u(i);"*"===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 u(t)}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.require=d,this.exports={}},u.modules=e,u.cache=l,u.parent=o,u.distDir=void 0,u.publicUrl=void 0,u.devServer=void 0,u.i=n,u.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(u,"root",{get:function(){return a[i]}}),a[i]=u;for(var c=0;c<t.length;c++)u(t[c]);if(r){var m=u(r);"object"==typeof exports&&"u">typeof module?module.exports=m:"function"==typeof define&&define.amd&&define(function(){return m})}}({"80h6e":[function(e,t,r,i){var s=e("@parcel/transformer-js/src/esmodule-helpers.js"),a=e("./Upscaler.js"),o=s.interopDefault(a);window.artplayerPluginWebsr=function(e={networkSize:"medium",compare:!1,weightsBaseUrl:"/weights",workerUrl:"/worker/main.js",videoScale:2}){return t=>{let{$video:r,$player:i}=t.template,s=document.createElement("canvas");function a(){let e=t.video,r=i.offsetWidth||640,s=i.offsetHeight||360,a=(e.videoWidth||640)/(e.videoHeight||360),o=r,n=s;return r/s>a?o=s*a:n=r/a,{displayWidth:o,displayHeight:n}}if(i.appendChild(s),s.style.position="absolute",s.style.zIndex="11",s.style.pointerEvents="none",s.style.top="50%",s.style.left="50%",s.style.transform="translate(-50%, -50%)",s.style.opacity="0",s.style.transition="opacity 0.2s ease",!o.default||!o.default.isSupported||!o.default.isSupported())return void console.warn("Upscaler is not supported in this environment");let n=new(0,o.default)({networkSize:e.networkSize||"medium",weightsBaseUrl:e.weightsBaseUrl||"/weights",workerUrl:e.workerUrl||"/worker/main.js",videoScale:e.videoScale||2}),l=!1;async function d(){if(!l){l=!0;try{await new Promise((e,t)=>{if(r.readyState>=1)return void e();let i=()=>{a(),e()},s=()=>{a(),t(Error("Failed to load video metadata"))},a=()=>{r.removeEventListener("loadedmetadata",i),r.removeEventListener("error",s)};r.addEventListener("loadedmetadata",i),r.addEventListener("error",s)}),await n.startRealtimeUpscale(r,s,e.networkSize||n.networkSize),requestAnimationFrame(()=>{s.style.opacity="1"})}catch(e){console.error("artplayer-plugin-upscaler: failed to start realtime",e)}}}let{displayWidth:u,displayHeight:c}=a();s.style.width=u+"px",s.style.height=c+"px";let m=50,h=!1,p=!!e.compare,f=document.createElement("div");function g(){if(p){let{displayWidth:e,displayHeight:t}=a(),r=`linear-gradient(to right, transparent 0%, transparent ${m}%, black ${m}%, black 100%)`;s.style.maskImage=r;let o=i.offsetWidth||640,n=i.offsetHeight||360,l=(o-e)/2+e*m/100;f.style.top=(n-t)/2+"px",f.style.left=l+"px",f.style.height=t+"px",f.style.transform="translateX(-50%)"}else s.style.maskImage="none"}function w(e){p&&(h=!0)}function y(e){if(p&&h){let t=i.getBoundingClientRect(),{displayWidth:r}=a(),s=i.offsetWidth||640;m=Math.max(0,Math.min(100,m=(e.clientX-t.left-(s-r)/2)/r*100)),g()}}function v(e){h=!1}return f.style.position="absolute",f.style.width="3px",f.style.backgroundColor="rgba(255, 255, 255, 0.75)",f.style.cursor="ew-resize",f.style.zIndex="12",f.style.pointerEvents="auto",f.style.display=p?"block":"none",f.style.boxShadow="0 0 2px rgba(0, 0, 0, 0.1)",p&&(i.appendChild(f),f.addEventListener("mousedown",w),document.addEventListener("mousemove",y),document.addEventListener("mouseup",v),g()),t.on("destroy",()=>{n&&"function"==typeof n.dispose&&n.dispose(),f.removeEventListener("mousedown",w),document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",v)}),t.on("resize",()=>{let{displayWidth:e,displayHeight:t}=a();s.style.width=e+"px",s.style.height=t+"px",g()}),t.on("play",()=>{d()}),{name:"artplayerPluginWebsr",upscaler:n,update:function(r={}){if(r&&"object"==typeof r){if(Object.prototype.hasOwnProperty.call(r,"compare")){let t=!!r.compare;e.compare=t,(p=t)?(f.parentNode||i.appendChild(f),f.style.display="block"Line truncated
|
||||
!function(e,t){"object"===typeof exports&&"undefined"!==typeof module?module.exports=t():"function"==typeof define&&define.amd?(t.ArtplayerPluginWebsr=t(),define(function(){return t.ArtplayerPluginWebsr})):(e="undefined"!==typeof globalThis?globalThis:e||self).ArtplayerPluginWebsr=t()}(this,function(){"use strict";var e=Object.defineProperty,t=(t,s,r)=>((t,s,r)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[s]=r)(t,"symbol"!==typeof s?s+"":s,r);const s=class e{static isSupported(){try{const e="undefined"!==typeof Worker,t="undefined"!==typeof OffscreenCanvas||"undefined"!==typeof document&&!!document.createElement("canvas").transferControlToOffscreen,s="undefined"!==typeof Blob;return e&&t&&s}catch{return!1}}static isVideoSupported(){try{return"undefined"!==typeof VideoEncoder&&"undefined"!==typeof VideoDecoder}catch{return!1}}constructor(t={}){const s=t.weightsBaseUrl||"/weights";this.networks=t.networks||{small:{name:"anime4k/cnn-2x-l",weightsUrl:`${s}/cnn-8.json`},medium:{name:"anime4k/cnn-2x-16",weightsUrl:`${s}/cnn-16.json`},large:{name:"anime4k/cnn-2x-28",weightsUrl:`${s}/cnn-28.json`}},this.weightsBaseUrl=s,this.networkSize=t.networkSize||"medium",this.workerUrl=t.workerUrl||"/worker/main.js",this.timeouts={...e.DEFAULT_TIMEOUTS,...t.timeouts||{}},this.delays={...e.DEFAULT_DELAYS,...t.delays||{}},this.imageScale="number"===typeof t.imageScale&&t.imageScale>0?t.imageScale:2,this.videoScale="number"===typeof t.videoScale&&t.videoScale>0?t.videoScale:2,this.weightsCache=new Map,this.workerInstance=null,this.messageHandlers={},this.progressCallback=null,this.processingType=null,this.realtimeLoopId=null,this.realtimeState=null,this.init()}init({prewarm:t=!0}={}){if(!e.isSupported())throw new Error("Upscaler is not supported in this environment");return t&&this.getWorker().postMessage({cmd:"isSupported"}),this}getWorker(){return this.workerInstance||(this.workerInstance=new Worker(this.workerUrl),this.workerInstance.onmessage=e=>this.handleWorkerMessage(e)),this.workerInstance}static extractProgressValue(e){const t=e.data??e.progress??e.value??e.percentage;return"number"===typeof t?Math.min(100,Math.max(0,Math.round(t))):null}handleBlobResponse(e){const t="video"===this.processingType?"videoBlob":"imageBlob",s=this.messageHandlers[t];e.data instanceof Blob&&s&&s({[t]:e.data})}requestBlob(){const e="video"===this.processingType?"getVideoBlob":"getImageBlob";this.getWorker().postMessage({cmd:e})}handleWorkerMessage(t){const{data:s}=t;if(!s.cmd)return;const{cmd:r}=s;if("progress"===r){const t=e.extractProgressValue(s);null!==t&&this.progressCallback&&this.progressCallback(t),this.messageHandlers.progress&&this.messageHandlers.progress(s)}else"finished"===r?s.data instanceof Blob?this.handleBlobResponse(s):this.requestBlob():this.messageHandlers[r]&&this.messageHandlers[r](s)}async loadWeights(e){if(this.validateNetworkSize(e),this.weightsCache.has(e))return this.weightsCache.get(e);const t=this.networks[e],s=await fetch(t.weightsUrl);if(!s.ok)throw new Error(`Failed to fetch weights: ${s.statusText}`);const r=await s.json();return this.weightsCache.set(e,r),r}static loadImageMetadata(e,t){return new Promise((s,r)=>{const i=new Blob([e],{type:t}),a=URL.createObjectURL(i),n=new Image;n.onload=()=>{URL.revokeObjectURL(a),s({width:n.width,height:n.height})},n.onerror=()=>{URL.revokeObjectURL(a),r(new Error("Failed to load image"))},n.src=a})}static loadVideoMetadata(e,t){return new Promise((s,r)=>{const i=URL.createObjectURL(e),a=document.createElement("video");a.src=i;const n=setTimeout(()=>r(new Error("Timeout")),t);a.onloadedmetadata=()=>{clearTimeout(n),URL.revokeObjectURL(i),s({width:a.videoWidth,height:a.videoHeight,duration:a.duration})},a.onerror=()=>{clearTimeout(n),URL.revokeObjectURL(i),r(new Error("Failed to load video"))}})}createOffscreenCanvas(e,t,s=2){const r="number"===typeof s&&s>0?s:1,i=document.createElement("canvas");if(i.width=e*r,i.height=t*r,"function"!==typeof i.transferControlToOffscreen)throw new TypeError("OffscreenCanvas is not supported in this environment");return i.transferControlToOffscreen()}createBlobPromise(e,t){return new Promise((s,r)=>{const i=setTimeout(()=>{this.messageHandlers[e]&&(delete this.messageHandlers[e],r(new Error(`${e} processing timeout`)))},t);this.messageHandlers[e]=t=>{delete this.messageHandlers[e],clearTimeout(i);const a=t[e]||t.data;a instanceof Blob?s(a):r(new Error(`Invalid ${e} format`))}})}validateNetworkSize(e){if(!this.networks[e])throw new Error(`Invalid networkSize: use one of ${Object.keys(this.networks).join(", ")}`)}async upscaleImage(t,s,r){if(!t)throw new Error("Image file is required");const i=s||this.networkSize;this.validateNetworkSize(i),this.processingType="image";const a=await t.arrayBuffer(),n=t.type||"image/jpeg",{width:o,height:d}=await e.loadImageMetadata(a,n),l=await this.loadWeights(i),c=this.networks[i],h="number"===typeof r&&r>0?r:this.imageScale,[m,u]=[this.createOffscreenCanvas(o,d,h),this.createOffscreLine truncated
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-websr.js v1.0.0
|
||||
* artplayer-plugin-websr.js v1.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,n,s){var o="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},i="function"==typeof o[n]&&o[n],a=i.i||{},c=i.cache||{},l="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(t,r){if(!c[t]){if(!e[t]){if(s[t])return s[t];var a="function"==typeof o[n]&&o[n];if(!r&&a)return a(t,!0);if(i)return i(t,!0);if(l&&"string"==typeof t)return l(t);var d=Error("Cannot find module '"+t+"'");throw d.code="MODULE_NOT_FOUND",d}h.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},h.cache={};var f=c[t]=new u.Module(t);e[t][0].call(f.exports,h,f,f.exports,o)}return c[t].exports;function h(e){var t=h.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],o=u(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]}})}):"*"===s?Object.defineProperty(r,t,{enumerable:!0,value:o}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===s?o.__esModule?o.default:o:o[s]}})}),r}return u(t)}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.require=l,this.exports={}},u.modules=e,u.cache=c,u.parent=i,u.distDir=void 0,u.publicUrl=void 0,u.devServer=void 0,u.i=a,u.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(u,"root",{get:function(){return o[n]}}),o[n]=u;for(var d=0;d<t.length;d++)u(t[d]);if(r){var f=u(r);"object"==typeof exports&&"u">typeof module?module.exports=f:"function"==typeof define&&define.amd&&define(function(){return f})}}({hrC3O:[function(e,t,r,n){var s=e("@parcel/transformer-js/src/esmodule-helpers.js"),o=e("@swc/helpers/cjs/_async_to_generator.cjs"),i=e("@swc/helpers/cjs/_type_of.cjs"),a=e("@swc/helpers/cjs/_ts_generator.cjs"),c=e("./Upscaler.js"),l=s.interopDefault(c);window.artplayerPluginWebsr=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{networkSize:"medium",compare:!1,weightsBaseUrl:"/weights",workerUrl:"/worker/main.js",videoScale:2};return function(t){var r=t.template,n=r.$video,s=r.$player,c=document.createElement("canvas");function u(){var e=t.video,r=s.offsetWidth||640,n=s.offsetHeight||360,o=(e.videoWidth||640)/(e.videoHeight||360),i=r,a=n;return r/n>o?i=n*o:a=r/o,{displayWidth:i,displayHeight:a}}if(s.appendChild(c),c.style.position="absolute",c.style.zIndex="11",c.style.pointerEvents="none",c.style.top="50%",c.style.left="50%",c.style.transform="translate(-50%, -50%)",c.style.opacity="0",c.style.transition="opacity 0.2s ease",!l.default||!l.default.isSupported||!l.default.isSupported())return void console.warn("Upscaler is not supported in this environment");var d=new(0,l.default)({networkSize:e.networkSize||"medium",weightsBaseUrl:e.weightsBaseUrl||"/weights",workerUrl:e.workerUrl||"/worker/main.js",videoScale:e.videoScale||2}),f=!1;function h(){return(0,o._)(function(){return(0,a._)(this,function(t){switch(t.label){case 0:if(f)return[2];f=!0,t.label=1;case 1:return t.trys.push([1,4,,5]),[4,new Promise(function(e,t){if(n.readyState>=1)return void e();var r=function(){o(),e()},s=function(){o(),t(Error("Failed to load video metadata"))},o=function(){n.removeEventListener("loadedmetadata",r),n.removeEventListener("error",s)};n.addEventListener("loadedmetadata",r),n.addEventListener("error",s)})];case 2:return t.sent(),[4,d.startRealtimeUpscale(n,c,e.networkSize||d.networkSize)];case 3:return t.sent(),requestAnimationFrame(function(){c.style.opacity="1"}),[3,5];case 4:return console.error("artplayer-plugin-upscaler: failed to start realtime",t.sent()),[3,5];case 5:return[2]}})})()}var p=u(),m=p.displayWidth,v=p.displayHeight;c.style.width=m+"px",c.style.height=v+"px";var g=50,y=!1,w=!!e.compare,b=document.createElement("div");function k(){if(w){var e=u(),t=e.displayWidth,r=e.displayHeight,n="linear-gradient(to right, transparent 0%, transparent ".concat(g,"%, black ").concat(g,"%, black 100%)");c.style.maskImage=n;var o=s.offsetWidth||640,i=s.offsetHeight||360,a=(o-t)/2+t*g/100;b.style.top=(i-r)/2+"px",b.style.left=a+"px",b.style.height=r+"px",b.style.transform="translateX(-50%)"}else c.style.maskImage="none"}function _(e){w&&(y=!0)}function j(e){if(w&&y){var t=s.getBoundingClientRect(),r=u().displayWidth,n=s.offsetWidth||640;g=Math.max(0,Math.min(100,g=(e.clientX-t.left-(n-r)/2)/r*100)),k()}}function E(e){y=!1}return b.style.position="absolute",b.style.width="3px",b.style.backgroundColor="rgba(255, 255, 255, 0.75)",b.style.cursor="ew-resize",b.style.zIndex="12",b.style.pointerEvents="auto",b.style.display=w?"block":"none",b.style.boxShadow="0 0 2px rgba(0, 0, 0, 0.1)",w&&(s.appendChild(b),b.addEventListener("mousedown",_),document.addEventListener("mousemove",j),document.addEventListener("mouseup",E),k()),t.on("destroy",function(){d&&"function"==typeof d.dispose&&d.dispose(),b.removeEventListeLine truncated
|
||||
!function(e,t){"object"===typeof exports&&"undefined"!==typeof module?module.exports=t():"function"==typeof define&&define.amd?(t.ArtplayerPluginWebsr=t(),define(function(){return t.ArtplayerPluginWebsr})):(e="undefined"!==typeof globalThis?globalThis:e||self).ArtplayerPluginWebsr=t()}(this,function(){"use strict";var e=Object.defineProperty,t=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,i=Math.pow,n=(t,r,s)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[r]=s,o=(e,i)=>{for(var o in i||(i={}))r.call(i,o)&&n(e,o,i[o]);if(t)for(var o of t(i))s.call(i,o)&&n(e,o,i[o]);return e},a=(e,t,r)=>n(e,"symbol"!==typeof t?t+"":t,r),l=(e,t,r)=>new Promise((s,i)=>{var n=e=>{try{a(r.next(e))}catch(t){i(t)}},o=e=>{try{a(r.throw(e))}catch(t){i(t)}},a=e=>e.done?s(e.value):Promise.resolve(e.value).then(n,o);a((r=r.apply(e,t)).next())});const d=class e{static isSupported(){try{const e="undefined"!==typeof Worker,t="undefined"!==typeof OffscreenCanvas||"undefined"!==typeof document&&!!document.createElement("canvas").transferControlToOffscreen,r="undefined"!==typeof Blob;return e&&t&&r}catch(e){return!1}}static isVideoSupported(){try{return"undefined"!==typeof VideoEncoder&&"undefined"!==typeof VideoDecoder}catch(e){return!1}}constructor(t={}){const r=t.weightsBaseUrl||"/weights";this.networks=t.networks||{small:{name:"anime4k/cnn-2x-l",weightsUrl:`${r}/cnn-8.json`},medium:{name:"anime4k/cnn-2x-16",weightsUrl:`${r}/cnn-16.json`},large:{name:"anime4k/cnn-2x-28",weightsUrl:`${r}/cnn-28.json`}},this.weightsBaseUrl=r,this.networkSize=t.networkSize||"medium",this.workerUrl=t.workerUrl||"/worker/main.js",this.timeouts=o(o({},e.DEFAULT_TIMEOUTS),t.timeouts||{}),this.delays=o(o({},e.DEFAULT_DELAYS),t.delays||{}),this.imageScale="number"===typeof t.imageScale&&t.imageScale>0?t.imageScale:2,this.videoScale="number"===typeof t.videoScale&&t.videoScale>0?t.videoScale:2,this.weightsCache=new Map,this.workerInstance=null,this.messageHandlers={},this.progressCallback=null,this.processingType=null,this.realtimeLoopId=null,this.realtimeState=null,this.init()}init({prewarm:t=!0}={}){if(!e.isSupported())throw new Error("Upscaler is not supported in this environment");return t&&this.getWorker().postMessage({cmd:"isSupported"}),this}getWorker(){return this.workerInstance||(this.workerInstance=new Worker(this.workerUrl),this.workerInstance.onmessage=e=>this.handleWorkerMessage(e)),this.workerInstance}static extractProgressValue(e){var t,r,s;const i=null!=(s=null!=(r=null!=(t=e.data)?t:e.progress)?r:e.value)?s:e.percentage;return"number"===typeof i?Math.min(100,Math.max(0,Math.round(i))):null}handleBlobResponse(e){const t="video"===this.processingType?"videoBlob":"imageBlob",r=this.messageHandlers[t];e.data instanceof Blob&&r&&r({[t]:e.data})}requestBlob(){const e="video"===this.processingType?"getVideoBlob":"getImageBlob";this.getWorker().postMessage({cmd:e})}handleWorkerMessage(t){const{data:r}=t;if(!r.cmd)return;const{cmd:s}=r;if("progress"===s){const t=e.extractProgressValue(r);null!==t&&this.progressCallback&&this.progressCallback(t),this.messageHandlers.progress&&this.messageHandlers.progress(r)}else"finished"===s?r.data instanceof Blob?this.handleBlobResponse(r):this.requestBlob():this.messageHandlers[s]&&this.messageHandlers[s](r)}loadWeights(e){return l(this,null,function*(){if(this.validateNetworkSize(e),this.weightsCache.has(e))return this.weightsCache.get(e);const t=this.networks[e],r=yield fetch(t.weightsUrl);if(!r.ok)throw new Error(`Failed to fetch weights: ${r.statusText}`);const s=yield r.json();return this.weightsCache.set(e,s),s})}static loadImageMetadata(e,t){return new Promise((r,s)=>{const i=new Blob([e],{type:t}),n=URL.createObjectURL(i),o=new Image;o.onload=()=>{URL.revokeObjectURL(n),r({width:o.width,height:o.height})},o.onerror=()=>{URL.revokeObjectURL(n),s(new Error("Failed to load image"))},o.src=n})}static loadVideoMetadata(e,t){return new Promise((r,s)=>{const i=URL.createObjectURL(e),n=document.createElement("video");n.src=i;const o=setTimeout(()=>s(new Error("Timeout")),t);n.onloadedmetadata=()=>{clearTimeout(o),URL.revokeObjectURL(i),r({width:n.videoWidth,height:n.videoHeight,duration:n.duration})},n.onerror=()=>{clearTimeout(o),URL.revokeObjectURL(i),s(new Error("Failed to load video"))}})}createOffscreenCanvas(e,t,r=2){const s="number"===typeof r&&r>0?r:1,i=document.createElement("canvas");if(i.width=e*s,i.height=t*s,"function"!==typeof i.transferControlToOffscreen)throw new TypeError("OffscreenCanvas is not supported in this environment");return i.transferControlToOffscreen()}createBlobPromise(e,t){return new Promise((r,s)=>{const i=setTimeout(()=>{this.messageHandlers[e]&&(delete this.messageHandlers[e],s(new Error(`${e} processing timeout`)))},t);this.messageHandlers[e]=t=>{delete this.messageHandlers[e],clearTimeout(i);const n=t[e]||t.data;n instanceof Blob?r(n):s(new Error(`Invalid ${e} format`))}})}validateNetworkSize(e){if(!this.netLine truncated
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-plugin-websr.js v1.0.0
|
||||
* artplayer-plugin-websr.js v1.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,i,a){var o="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},s="function"==typeof o[i]&&o[i],n=s.i||{},l=s.cache||{},d="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(t,r){if(!l[t]){if(!e[t]){if(a[t])return a[t];var n="function"==typeof o[i]&&o[i];if(!r&&n)return n(t,!0);if(s)return s(t,!0);if(d&&"string"==typeof t)return d(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}h.resolve=function(r){var i=e[t][1][r];return null!=i?i:r},h.cache={};var m=l[t]=new u.Module(t);e[t][0].call(m.exports,h,m,m.exports,o)}return l[t].exports;function h(e){var t=h.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],i=e[1],a=e[2]||e[0],o=u(i);"*"===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 u(t)}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.require=d,this.exports={}},u.modules=e,u.cache=l,u.parent=s,u.distDir=void 0,u.publicUrl=void 0,u.devServer=void 0,u.i=n,u.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(u,"root",{get:function(){return o[i]}}),o[i]=u;for(var c=0;c<t.length;c++)u(t[c]);if(r){var m=u(r);"object"==typeof exports&&"u">typeof module?module.exports=m:"function"==typeof define&&define.amd&&define(function(){return m})}}({hOg5u:[function(e,t,r,i){var a=e("@parcel/transformer-js/src/esmodule-helpers.js"),o=e("./Upscaler.js"),s=a.interopDefault(o);window.artplayerPluginWebsr=function(e={networkSize:"medium",compare:!1,weightsBaseUrl:"/weights",workerUrl:"/worker/main.js",videoScale:2}){return t=>{let{$video:r,$player:i}=t.template,a=document.createElement("canvas");function o(){let e=t.video,r=i.offsetWidth||640,a=i.offsetHeight||360,o=(e.videoWidth||640)/(e.videoHeight||360),s=r,n=a;return r/a>o?s=a*o:n=r/o,{displayWidth:s,displayHeight:n}}if(i.appendChild(a),a.style.position="absolute",a.style.zIndex="11",a.style.pointerEvents="none",a.style.top="50%",a.style.left="50%",a.style.transform="translate(-50%, -50%)",a.style.opacity="0",a.style.transition="opacity 0.2s ease",!s.default||!s.default.isSupported||!s.default.isSupported())return void console.warn("Upscaler is not supported in this environment");let n=new(0,s.default)({networkSize:e.networkSize||"medium",weightsBaseUrl:e.weightsBaseUrl||"/weights",workerUrl:e.workerUrl||"/worker/main.js",videoScale:e.videoScale||2}),l=!1;async function d(){if(!l){l=!0;try{await new Promise((e,t)=>{if(r.readyState>=1)return void e();let i=()=>{o(),e()},a=()=>{o(),t(Error("Failed to load video metadata"))},o=()=>{r.removeEventListener("loadedmetadata",i),r.removeEventListener("error",a)};r.addEventListener("loadedmetadata",i),r.addEventListener("error",a)}),await n.startRealtimeUpscale(r,a,e.networkSize||n.networkSize),requestAnimationFrame(()=>{a.style.opacity="1"})}catch(e){console.error("artplayer-plugin-upscaler: failed to start realtime",e)}}}let{displayWidth:u,displayHeight:c}=o();a.style.width=u+"px",a.style.height=c+"px";let m=50,h=!1,p=!!e.compare,f=document.createElement("div");function g(){if(p){let{displayWidth:e,displayHeight:t}=o(),r=`linear-gradient(to right, transparent 0%, transparent ${m}%, black ${m}%, black 100%)`;a.style.maskImage=r;let s=i.offsetWidth||640,n=i.offsetHeight||360,l=(s-e)/2+e*m/100;f.style.top=(n-t)/2+"px",f.style.left=l+"px",f.style.height=t+"px",f.style.transform="translateX(-50%)"}else a.style.maskImage="none"}function w(e){p&&(h=!0)}function y(e){if(p&&h){let t=i.getBoundingClientRect(),{displayWidth:r}=o(),a=i.offsetWidth||640;m=Math.max(0,Math.min(100,m=(e.clientX-t.left-(a-r)/2)/r*100)),g()}}function v(e){h=!1}return f.style.position="absolute",f.style.width="3px",f.style.backgroundColor="rgba(255, 255, 255, 0.75)",f.style.cursor="ew-resize",f.style.zIndex="12",f.style.pointerEvents="auto",f.style.display=p?"block":"none",f.style.boxShadow="0 0 2px rgba(0, 0, 0, 0.1)",p&&(i.appendChild(f),f.addEventListener("mousedown",w),document.addEventListener("mousemove",y),document.addEventListener("mouseup",v),g()),t.on("destroy",()=>{n&&"function"==typeof n.dispose&&n.dispose(),f.removeEventListener("mousedown",w),document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",v)}),t.on("resize",()=>{let{displayWidth:e,displayHeight:t}=o();a.style.width=e+"px",a.style.height=t+"px",g()}),t.on("play",()=>{d()}),{name:"artplayerPluginWebsr",upscaler:n,update:function(r={}){if(r&&"object"==typeof r){if(Object.prototype.hasOwnProperty.call(r,"compare")){let t=!!r.compare;e.compare=t,(p=t)?(f.parentNode||i.appendChild(f),f.style.display="block",fLine truncated
|
||||
var e=Object.defineProperty,t=(t,s,r)=>((t,s,r)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[s]=r)(t,"symbol"!==typeof s?s+"":s,r);const s=class e{static isSupported(){try{const e="undefined"!==typeof Worker,t="undefined"!==typeof OffscreenCanvas||"undefined"!==typeof document&&!!document.createElement("canvas").transferControlToOffscreen,s="undefined"!==typeof Blob;return e&&t&&s}catch{return!1}}static isVideoSupported(){try{return"undefined"!==typeof VideoEncoder&&"undefined"!==typeof VideoDecoder}catch{return!1}}constructor(t={}){const s=t.weightsBaseUrl||"/weights";this.networks=t.networks||{small:{name:"anime4k/cnn-2x-l",weightsUrl:`${s}/cnn-8.json`},medium:{name:"anime4k/cnn-2x-16",weightsUrl:`${s}/cnn-16.json`},large:{name:"anime4k/cnn-2x-28",weightsUrl:`${s}/cnn-28.json`}},this.weightsBaseUrl=s,this.networkSize=t.networkSize||"medium",this.workerUrl=t.workerUrl||"/worker/main.js",this.timeouts={...e.DEFAULT_TIMEOUTS,...t.timeouts||{}},this.delays={...e.DEFAULT_DELAYS,...t.delays||{}},this.imageScale="number"===typeof t.imageScale&&t.imageScale>0?t.imageScale:2,this.videoScale="number"===typeof t.videoScale&&t.videoScale>0?t.videoScale:2,this.weightsCache=/* @__PURE__ */new Map,this.workerInstance=null,this.messageHandlers={},this.progressCallback=null,this.processingType=null,this.realtimeLoopId=null,this.realtimeState=null,this.init()}init({prewarm:t=!0}={}){if(!e.isSupported())throw new Error("Upscaler is not supported in this environment");return t&&this.getWorker().postMessage({cmd:"isSupported"}),this}getWorker(){return this.workerInstance||(this.workerInstance=new Worker(this.workerUrl),this.workerInstance.onmessage=e=>this.handleWorkerMessage(e)),this.workerInstance}static extractProgressValue(e){const t=e.data??e.progress??e.value??e.percentage;return"number"===typeof t?Math.min(100,Math.max(0,Math.round(t))):null}handleBlobResponse(e){const t="video"===this.processingType?"videoBlob":"imageBlob",s=this.messageHandlers[t];e.data instanceof Blob&&s&&s({[t]:e.data})}requestBlob(){const e="video"===this.processingType?"getVideoBlob":"getImageBlob";this.getWorker().postMessage({cmd:e})}handleWorkerMessage(t){const{data:s}=t;if(!s.cmd)return;const{cmd:r}=s;if("progress"===r){const t=e.extractProgressValue(s);null!==t&&this.progressCallback&&this.progressCallback(t),this.messageHandlers.progress&&this.messageHandlers.progress(s)}else"finished"===r?s.data instanceof Blob?this.handleBlobResponse(s):this.requestBlob():this.messageHandlers[r]&&this.messageHandlers[r](s)}async loadWeights(e){if(this.validateNetworkSize(e),this.weightsCache.has(e))return this.weightsCache.get(e);const t=this.networks[e],s=await fetch(t.weightsUrl);if(!s.ok)throw new Error(`Failed to fetch weights: ${s.statusText}`);const r=await s.json();return this.weightsCache.set(e,r),r}static loadImageMetadata(e,t){return new Promise((s,r)=>{const i=new Blob([e],{type:t}),a=URL.createObjectURL(i),n=new Image;n.onload=()=>{URL.revokeObjectURL(a),s({width:n.width,height:n.height})},n.onerror=()=>{URL.revokeObjectURL(a),r(new Error("Failed to load image"))},n.src=a})}static loadVideoMetadata(e,t){return new Promise((s,r)=>{const i=URL.createObjectURL(e),a=document.createElement("video");a.src=i;const n=setTimeout(()=>r(new Error("Timeout")),t);a.onloadedmetadata=()=>{clearTimeout(n),URL.revokeObjectURL(i),s({width:a.videoWidth,height:a.videoHeight,duration:a.duration})},a.onerror=()=>{clearTimeout(n),URL.revokeObjectURL(i),r(new Error("Failed to load video"))}})}createOffscreenCanvas(e,t,s=2){const r="number"===typeof s&&s>0?s:1,i=document.createElement("canvas");if(i.width=e*r,i.height=t*r,"function"!==typeof i.transferControlToOffscreen)throw new TypeError("OffscreenCanvas is not supported in this environment");return i.transferControlToOffscreen()}createBlobPromise(e,t){return new Promise((s,r)=>{const i=setTimeout(()=>{this.messageHandlers[e]&&(delete this.messageHandlers[e],r(new Error(`${e} processing timeout`)))},t);this.messageHandlers[e]=t=>{delete this.messageHandlers[e],clearTimeout(i);const a=t[e]||t.data;a instanceof Blob?s(a):r(new Error(`Invalid ${e} format`))}})}validateNetworkSize(e){if(!this.networks[e])throw new Error(`Invalid networkSize: use one of ${Object.keys(this.networks).join(", ")}`)}async upscaleImage(t,s,r){if(!t)throw new Error("Image file is required");const i=s||this.networkSize;this.validateNetworkSize(i),this.processingType="image";const a=await t.arrayBuffer(),n=t.type||"image/jpeg",{width:o,height:d}=await e.loadImageMetadata(a,n),l=await this.loadWeights(i),c=this.networks[i],h="number"===typeof r&&r>0?r:this.imageScale,[m,u]=[this.createOffscreenCanvas(o,d,h),this.createOffscreenCanvas(o,d,1)],p=this.createBlobPromise("imageBlob",this.timeouts.IMAGE);return this.getWorker().postMessage({cmd:"init",data:{imageArrayBuffer:a,imageMimeType:n,upscaled:m,original:u,resolution:{width:o,height:d},network_name:c.name,weights:l}},[m,u]),setTimeout(()=>{this.getWorker().postMessage({Line truncated
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "artplayer-plugin-websr",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "AI upscaling plugin for ArtPlayer using WebSR - real-time video super-resolution with WebGPU",
|
||||
"author": "Harvey Zhao <laozhaochaguan@gmail.com>",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,280 +1,288 @@
|
||||
export default class Upscaler {
|
||||
static DEFAULT_TIMEOUTS = { IMAGE: 300000, VIDEO: 3600000, METADATA: 10000 };
|
||||
static DEFAULT_DELAYS = { INIT: 500, NETWORK: 300 };
|
||||
static DEFAULT_TIMEOUTS = { IMAGE: 300000, VIDEO: 3600000, METADATA: 10000 }
|
||||
static DEFAULT_DELAYS = { INIT: 500, NETWORK: 300 }
|
||||
|
||||
static isSupported() {
|
||||
try {
|
||||
const hasWorker = typeof Worker !== "undefined";
|
||||
const hasOffscreen =
|
||||
typeof OffscreenCanvas !== "undefined" ||
|
||||
(typeof document !== "undefined" &&
|
||||
!!document.createElement("canvas").transferControlToOffscreen);
|
||||
const hasBlob = typeof Blob !== "undefined";
|
||||
return hasWorker && hasOffscreen && hasBlob;
|
||||
} catch {
|
||||
return false;
|
||||
const hasWorker = typeof Worker !== 'undefined'
|
||||
const hasOffscreen
|
||||
= typeof OffscreenCanvas !== 'undefined'
|
||||
|| (typeof document !== 'undefined'
|
||||
&& !!document.createElement('canvas').transferControlToOffscreen)
|
||||
const hasBlob = typeof Blob !== 'undefined'
|
||||
return hasWorker && hasOffscreen && hasBlob
|
||||
}
|
||||
catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
static isVideoSupported() {
|
||||
try {
|
||||
return (
|
||||
typeof VideoEncoder !== "undefined" &&
|
||||
typeof VideoDecoder !== "undefined"
|
||||
);
|
||||
} catch {
|
||||
return false;
|
||||
typeof VideoEncoder !== 'undefined'
|
||||
&& typeof VideoDecoder !== 'undefined'
|
||||
)
|
||||
}
|
||||
catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
constructor(options = {}) {
|
||||
const weightsBaseUrl = options.weightsBaseUrl || "/weights";
|
||||
const weightsBaseUrl = options.weightsBaseUrl || '/weights'
|
||||
|
||||
this.networks = options.networks || {
|
||||
small: {
|
||||
name: "anime4k/cnn-2x-l",
|
||||
name: 'anime4k/cnn-2x-l',
|
||||
weightsUrl: `${weightsBaseUrl}/cnn-8.json`,
|
||||
},
|
||||
medium: {
|
||||
name: "anime4k/cnn-2x-16",
|
||||
name: 'anime4k/cnn-2x-16',
|
||||
weightsUrl: `${weightsBaseUrl}/cnn-16.json`,
|
||||
},
|
||||
large: {
|
||||
name: "anime4k/cnn-2x-28",
|
||||
name: 'anime4k/cnn-2x-28',
|
||||
weightsUrl: `${weightsBaseUrl}/cnn-28.json`,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
this.weightsBaseUrl = weightsBaseUrl;
|
||||
this.networkSize = options.networkSize || "medium";
|
||||
this.workerUrl = options.workerUrl || "/worker/main.js";
|
||||
this.weightsBaseUrl = weightsBaseUrl
|
||||
this.networkSize = options.networkSize || 'medium'
|
||||
this.workerUrl = options.workerUrl || '/worker/main.js'
|
||||
|
||||
this.timeouts = {
|
||||
...Upscaler.DEFAULT_TIMEOUTS,
|
||||
...(options.timeouts || {}),
|
||||
};
|
||||
this.delays = { ...Upscaler.DEFAULT_DELAYS, ...(options.delays || {}) };
|
||||
}
|
||||
this.delays = { ...Upscaler.DEFAULT_DELAYS, ...(options.delays || {}) }
|
||||
|
||||
this.imageScale =
|
||||
typeof options.imageScale === "number" && options.imageScale > 0
|
||||
this.imageScale
|
||||
= typeof options.imageScale === 'number' && options.imageScale > 0
|
||||
? options.imageScale
|
||||
: 2;
|
||||
this.videoScale =
|
||||
typeof options.videoScale === "number" && options.videoScale > 0
|
||||
: 2
|
||||
this.videoScale
|
||||
= typeof options.videoScale === 'number' && options.videoScale > 0
|
||||
? options.videoScale
|
||||
: 2;
|
||||
: 2
|
||||
|
||||
this.weightsCache = new Map();
|
||||
this.workerInstance = null;
|
||||
this.messageHandlers = {};
|
||||
this.progressCallback = null;
|
||||
this.processingType = null;
|
||||
this.weightsCache = new Map()
|
||||
this.workerInstance = null
|
||||
this.messageHandlers = {}
|
||||
this.progressCallback = null
|
||||
this.processingType = null
|
||||
|
||||
this.realtimeLoopId = null;
|
||||
this.realtimeState = null;
|
||||
this.realtimeLoopId = null
|
||||
this.realtimeState = null
|
||||
|
||||
this.init();
|
||||
this.init()
|
||||
}
|
||||
|
||||
init({ prewarm = true } = {}) {
|
||||
if (!Upscaler.isSupported()) {
|
||||
throw new Error("Upscaler is not supported in this environment");
|
||||
throw new Error('Upscaler is not supported in this environment')
|
||||
}
|
||||
if (prewarm) {
|
||||
this.getWorker().postMessage({ cmd: "isSupported" });
|
||||
this.getWorker().postMessage({ cmd: 'isSupported' })
|
||||
}
|
||||
return this;
|
||||
return this
|
||||
}
|
||||
|
||||
getWorker() {
|
||||
if (!this.workerInstance) {
|
||||
this.workerInstance = new Worker(this.workerUrl);
|
||||
this.workerInstance.onmessage = (event) =>
|
||||
this.handleWorkerMessage(event);
|
||||
this.workerInstance = new Worker(this.workerUrl)
|
||||
this.workerInstance.onmessage = event =>
|
||||
this.handleWorkerMessage(event)
|
||||
}
|
||||
return this.workerInstance;
|
||||
return this.workerInstance
|
||||
}
|
||||
|
||||
static extractProgressValue(data) {
|
||||
const value = data.data ?? data.progress ?? data.value ?? data.percentage;
|
||||
return typeof value === "number"
|
||||
const value = data.data ?? data.progress ?? data.value ?? data.percentage
|
||||
return typeof value === 'number'
|
||||
? Math.min(100, Math.max(0, Math.round(value)))
|
||||
: null;
|
||||
: null
|
||||
}
|
||||
|
||||
handleBlobResponse(data) {
|
||||
const blobType =
|
||||
this.processingType === "video" ? "videoBlob" : "imageBlob";
|
||||
const handler = this.messageHandlers[blobType];
|
||||
const blobType
|
||||
= this.processingType === 'video' ? 'videoBlob' : 'imageBlob'
|
||||
const handler = this.messageHandlers[blobType]
|
||||
if (data.data instanceof Blob && handler) {
|
||||
handler({ [blobType]: data.data });
|
||||
handler({ [blobType]: data.data })
|
||||
}
|
||||
}
|
||||
|
||||
requestBlob() {
|
||||
const cmd =
|
||||
this.processingType === "video" ? "getVideoBlob" : "getImageBlob";
|
||||
this.getWorker().postMessage({ cmd });
|
||||
const cmd
|
||||
= this.processingType === 'video' ? 'getVideoBlob' : 'getImageBlob'
|
||||
this.getWorker().postMessage({ cmd })
|
||||
}
|
||||
|
||||
handleWorkerMessage(event) {
|
||||
const { data } = event;
|
||||
console.debug("Worker message:", data);
|
||||
if (!data.cmd) return;
|
||||
const { data } = event
|
||||
if (!data.cmd)
|
||||
return
|
||||
|
||||
const { cmd } = data;
|
||||
const { cmd } = data
|
||||
|
||||
if (cmd === "progress") {
|
||||
const progress = Upscaler.extractProgressValue(data);
|
||||
if (cmd === 'progress') {
|
||||
const progress = Upscaler.extractProgressValue(data)
|
||||
if (progress !== null && this.progressCallback) {
|
||||
this.progressCallback(progress);
|
||||
this.progressCallback(progress)
|
||||
}
|
||||
if (this.messageHandlers.progress) this.messageHandlers.progress(data);
|
||||
} else if (cmd === "finished") {
|
||||
if (this.messageHandlers.progress)
|
||||
this.messageHandlers.progress(data)
|
||||
}
|
||||
else if (cmd === 'finished') {
|
||||
if (data.data instanceof Blob) {
|
||||
this.handleBlobResponse(data);
|
||||
} else {
|
||||
this.requestBlob();
|
||||
this.handleBlobResponse(data)
|
||||
}
|
||||
} else if (this.messageHandlers[cmd]) {
|
||||
this.messageHandlers[cmd](data);
|
||||
else {
|
||||
this.requestBlob()
|
||||
}
|
||||
}
|
||||
else if (this.messageHandlers[cmd]) {
|
||||
this.messageHandlers[cmd](data)
|
||||
}
|
||||
}
|
||||
|
||||
async loadWeights(networkSize) {
|
||||
this.validateNetworkSize(networkSize);
|
||||
this.validateNetworkSize(networkSize)
|
||||
if (this.weightsCache.has(networkSize)) {
|
||||
return this.weightsCache.get(networkSize);
|
||||
return this.weightsCache.get(networkSize)
|
||||
}
|
||||
const network = this.networks[networkSize];
|
||||
const response = await fetch(network.weightsUrl);
|
||||
const network = this.networks[networkSize]
|
||||
const response = await fetch(network.weightsUrl)
|
||||
if (!response.ok)
|
||||
throw new Error(`Failed to fetch weights: ${response.statusText}`);
|
||||
const weights = await response.json();
|
||||
this.weightsCache.set(networkSize, weights);
|
||||
return weights;
|
||||
throw new Error(`Failed to fetch weights: ${response.statusText}`)
|
||||
const weights = await response.json()
|
||||
this.weightsCache.set(networkSize, weights)
|
||||
return weights
|
||||
}
|
||||
|
||||
static loadImageMetadata(arrayBuffer, mimeType) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const blob = new Blob([arrayBuffer], { type: mimeType });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const img = new Image();
|
||||
const blob = new Blob([arrayBuffer], { type: mimeType })
|
||||
const url = URL.createObjectURL(blob)
|
||||
const img = new Image()
|
||||
|
||||
img.onload = () => {
|
||||
URL.revokeObjectURL(url);
|
||||
resolve({ width: img.width, height: img.height });
|
||||
};
|
||||
URL.revokeObjectURL(url)
|
||||
resolve({ width: img.width, height: img.height })
|
||||
}
|
||||
|
||||
img.onerror = () => {
|
||||
URL.revokeObjectURL(url);
|
||||
reject(new Error("Failed to load image"));
|
||||
};
|
||||
URL.revokeObjectURL(url)
|
||||
reject(new Error('Failed to load image'))
|
||||
}
|
||||
|
||||
img.src = url;
|
||||
});
|
||||
img.src = url
|
||||
})
|
||||
}
|
||||
|
||||
static loadVideoMetadata(file, timeoutMs) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const url = URL.createObjectURL(file);
|
||||
const video = document.createElement("video");
|
||||
video.src = url;
|
||||
const url = URL.createObjectURL(file)
|
||||
const video = document.createElement('video')
|
||||
video.src = url
|
||||
|
||||
const timeout = setTimeout(() => reject(new Error("Timeout")), timeoutMs);
|
||||
const timeout = setTimeout(() => reject(new Error('Timeout')), timeoutMs)
|
||||
|
||||
video.onloadedmetadata = () => {
|
||||
clearTimeout(timeout);
|
||||
URL.revokeObjectURL(url);
|
||||
clearTimeout(timeout)
|
||||
URL.revokeObjectURL(url)
|
||||
resolve({
|
||||
width: video.videoWidth,
|
||||
height: video.videoHeight,
|
||||
duration: video.duration,
|
||||
});
|
||||
};
|
||||
})
|
||||
}
|
||||
|
||||
video.onerror = () => {
|
||||
clearTimeout(timeout);
|
||||
URL.revokeObjectURL(url);
|
||||
reject(new Error("Failed to load video"));
|
||||
};
|
||||
});
|
||||
clearTimeout(timeout)
|
||||
URL.revokeObjectURL(url)
|
||||
reject(new Error('Failed to load video'))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
createOffscreenCanvas(width, height, scale = 2) {
|
||||
const factor = typeof scale === "number" && scale > 0 ? scale : 1;
|
||||
const canvas = document.createElement("canvas");
|
||||
canvas.width = width * factor;
|
||||
canvas.height = height * factor;
|
||||
if (typeof canvas.transferControlToOffscreen !== "function") {
|
||||
throw new Error("OffscreenCanvas is not supported in this environment");
|
||||
const factor = typeof scale === 'number' && scale > 0 ? scale : 1
|
||||
const canvas = document.createElement('canvas')
|
||||
canvas.width = width * factor
|
||||
canvas.height = height * factor
|
||||
if (typeof canvas.transferControlToOffscreen !== 'function') {
|
||||
throw new TypeError('OffscreenCanvas is not supported in this environment')
|
||||
}
|
||||
return canvas.transferControlToOffscreen();
|
||||
return canvas.transferControlToOffscreen()
|
||||
}
|
||||
|
||||
createBlobPromise(blobType, timeout) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const timeoutId = setTimeout(() => {
|
||||
if (this.messageHandlers[blobType]) {
|
||||
delete this.messageHandlers[blobType];
|
||||
reject(new Error(`${blobType} processing timeout`));
|
||||
delete this.messageHandlers[blobType]
|
||||
reject(new Error(`${blobType} processing timeout`))
|
||||
}
|
||||
}, timeout);
|
||||
}, timeout)
|
||||
|
||||
this.messageHandlers[blobType] = (msg) => {
|
||||
delete this.messageHandlers[blobType];
|
||||
clearTimeout(timeoutId);
|
||||
const blob = msg[blobType] || msg.data;
|
||||
delete this.messageHandlers[blobType]
|
||||
clearTimeout(timeoutId)
|
||||
const blob = msg[blobType] || msg.data
|
||||
if (blob instanceof Blob) {
|
||||
resolve(blob);
|
||||
} else {
|
||||
reject(new Error(`Invalid ${blobType} format`));
|
||||
resolve(blob)
|
||||
}
|
||||
};
|
||||
});
|
||||
else {
|
||||
reject(new Error(`Invalid ${blobType} format`))
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
validateNetworkSize(size) {
|
||||
if (!this.networks[size]) {
|
||||
throw new Error(
|
||||
"Invalid networkSize: use one of " +
|
||||
Object.keys(this.networks).join(", "),
|
||||
);
|
||||
`Invalid networkSize: use one of ${
|
||||
Object.keys(this.networks).join(', ')}`,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
async upscaleImage(imageFile, networkSize, scaleOverride) {
|
||||
if (!imageFile) throw new Error("Image file is required");
|
||||
const size = networkSize || this.networkSize;
|
||||
this.validateNetworkSize(size);
|
||||
if (!imageFile)
|
||||
throw new Error('Image file is required')
|
||||
const size = networkSize || this.networkSize
|
||||
this.validateNetworkSize(size)
|
||||
|
||||
this.processingType = "image";
|
||||
const arrayBuffer = await imageFile.arrayBuffer();
|
||||
const mimeType = imageFile.type || "image/jpeg";
|
||||
this.processingType = 'image'
|
||||
const arrayBuffer = await imageFile.arrayBuffer()
|
||||
const mimeType = imageFile.type || 'image/jpeg'
|
||||
const { width, height } = await Upscaler.loadImageMetadata(
|
||||
arrayBuffer,
|
||||
mimeType,
|
||||
);
|
||||
)
|
||||
|
||||
const weights = await this.loadWeights(size);
|
||||
const network = this.networks[size];
|
||||
const scale =
|
||||
typeof scaleOverride === "number" && scaleOverride > 0
|
||||
const weights = await this.loadWeights(size)
|
||||
const network = this.networks[size]
|
||||
const scale
|
||||
= typeof scaleOverride === 'number' && scaleOverride > 0
|
||||
? scaleOverride
|
||||
: this.imageScale;
|
||||
: this.imageScale
|
||||
const [canvasUp, canvasOrig] = [
|
||||
this.createOffscreenCanvas(width, height, scale),
|
||||
this.createOffscreenCanvas(width, height, 1),
|
||||
];
|
||||
]
|
||||
|
||||
const blobPromise = this.createBlobPromise(
|
||||
"imageBlob",
|
||||
'imageBlob',
|
||||
this.timeouts.IMAGE,
|
||||
);
|
||||
)
|
||||
|
||||
this.getWorker().postMessage(
|
||||
{
|
||||
cmd: "init",
|
||||
cmd: 'init',
|
||||
data: {
|
||||
imageArrayBuffer: arrayBuffer,
|
||||
imageMimeType: mimeType,
|
||||
@@ -286,64 +294,65 @@ export default class Upscaler {
|
||||
},
|
||||
},
|
||||
[canvasUp, canvasOrig],
|
||||
);
|
||||
)
|
||||
|
||||
setTimeout(() => {
|
||||
this.getWorker().postMessage({
|
||||
cmd: "network",
|
||||
cmd: 'network',
|
||||
data: {
|
||||
name: network.name,
|
||||
imageArrayBuffer: arrayBuffer,
|
||||
imageMimeType: mimeType,
|
||||
weights,
|
||||
},
|
||||
});
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
this.getWorker().postMessage({
|
||||
cmd: "getImageBlob",
|
||||
cmd: 'getImageBlob',
|
||||
data: { imageArrayBuffer: arrayBuffer, imageMimeType: mimeType },
|
||||
});
|
||||
}, this.delays.NETWORK);
|
||||
}, this.delays.INIT);
|
||||
})
|
||||
}, this.delays.NETWORK)
|
||||
}, this.delays.INIT)
|
||||
|
||||
return blobPromise;
|
||||
return blobPromise
|
||||
}
|
||||
|
||||
async upscaleVideo(videoFile, networkSize, scaleOverride) {
|
||||
if (!videoFile) throw new Error("Video file is required");
|
||||
const size = networkSize || this.networkSize;
|
||||
this.validateNetworkSize(size);
|
||||
if (!videoFile)
|
||||
throw new Error('Video file is required')
|
||||
const size = networkSize || this.networkSize
|
||||
this.validateNetworkSize(size)
|
||||
|
||||
if (!Upscaler.isVideoSupported()) {
|
||||
throw new Error("WebCodecs API not supported. Requires Chrome 94+");
|
||||
throw new Error('WebCodecs API not supported. Requires Chrome 94+')
|
||||
}
|
||||
|
||||
this.processingType = "video";
|
||||
this.processingType = 'video'
|
||||
const { width, height, duration } = await Upscaler.loadVideoMetadata(
|
||||
videoFile,
|
||||
this.timeouts.METADATA,
|
||||
);
|
||||
)
|
||||
|
||||
const weights = await this.loadWeights(size);
|
||||
const network = this.networks[size];
|
||||
const scale =
|
||||
typeof scaleOverride === "number" && scaleOverride > 0
|
||||
const weights = await this.loadWeights(size)
|
||||
const network = this.networks[size]
|
||||
const scale
|
||||
= typeof scaleOverride === 'number' && scaleOverride > 0
|
||||
? scaleOverride
|
||||
: this.videoScale;
|
||||
: this.videoScale
|
||||
const [canvasOut, canvasIn] = [
|
||||
this.createOffscreenCanvas(width, height, scale),
|
||||
this.createOffscreenCanvas(width, height, 1),
|
||||
];
|
||||
]
|
||||
|
||||
const blobPromise = this.createBlobPromise(
|
||||
"videoBlob",
|
||||
'videoBlob',
|
||||
this.timeouts.VIDEO,
|
||||
);
|
||||
)
|
||||
|
||||
this.getWorker().postMessage(
|
||||
{
|
||||
cmd: "process",
|
||||
cmd: 'process',
|
||||
file: videoFile,
|
||||
fileSize: videoFile.size,
|
||||
duration,
|
||||
@@ -360,9 +369,9 @@ export default class Upscaler {
|
||||
skipDemuxProgress: true,
|
||||
},
|
||||
[canvasOut, canvasIn],
|
||||
);
|
||||
)
|
||||
|
||||
return blobPromise;
|
||||
return blobPromise
|
||||
}
|
||||
|
||||
async startRealtimeUpscale(
|
||||
@@ -372,78 +381,79 @@ export default class Upscaler {
|
||||
scaleOverride,
|
||||
) {
|
||||
if (!videoElement || !canvasElement) {
|
||||
throw new Error("videoElement and canvasElement are required");
|
||||
throw new Error('videoElement and canvasElement are required')
|
||||
}
|
||||
|
||||
const size = networkSize || this.networkSize;
|
||||
this.validateNetworkSize(size);
|
||||
const size = networkSize || this.networkSize
|
||||
this.validateNetworkSize(size)
|
||||
|
||||
const network = this.networks[size];
|
||||
const weights = await this.loadWeights(size);
|
||||
const network = this.networks[size]
|
||||
const weights = await this.loadWeights(size)
|
||||
|
||||
const scale =
|
||||
typeof scaleOverride === "number" && scaleOverride > 0
|
||||
const scale
|
||||
= typeof scaleOverride === 'number' && scaleOverride > 0
|
||||
? scaleOverride
|
||||
: this.videoScale;
|
||||
: this.videoScale
|
||||
|
||||
const ensureMetadata = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (videoElement.readyState >= 1) {
|
||||
resolve();
|
||||
return;
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
const onLoaded = () => {
|
||||
cleanup();
|
||||
resolve();
|
||||
};
|
||||
const onError = () => {
|
||||
cleanup();
|
||||
reject(new Error("Failed to load video metadata"));
|
||||
};
|
||||
let onLoaded, onError
|
||||
const cleanup = () => {
|
||||
videoElement.removeEventListener("loadedmetadata", onLoaded);
|
||||
videoElement.removeEventListener("error", onError);
|
||||
};
|
||||
videoElement.addEventListener("loadedmetadata", onLoaded);
|
||||
videoElement.addEventListener("error", onError);
|
||||
});
|
||||
};
|
||||
|
||||
await ensureMetadata();
|
||||
|
||||
const width = videoElement.videoWidth;
|
||||
const height = videoElement.videoHeight;
|
||||
if (!width || !height) {
|
||||
throw new Error("Invalid video dimensions");
|
||||
videoElement.removeEventListener('loadedmetadata', onLoaded)
|
||||
videoElement.removeEventListener('error', onError)
|
||||
}
|
||||
onLoaded = () => {
|
||||
cleanup()
|
||||
resolve()
|
||||
}
|
||||
onError = () => {
|
||||
cleanup()
|
||||
reject(new Error('Failed to load video metadata'))
|
||||
}
|
||||
videoElement.addEventListener('loadedmetadata', onLoaded)
|
||||
videoElement.addEventListener('error', onError)
|
||||
})
|
||||
}
|
||||
|
||||
const firstInit = !canvasElement._upscalerTransferred;
|
||||
await ensureMetadata()
|
||||
|
||||
let offscreen = null;
|
||||
const width = videoElement.videoWidth
|
||||
const height = videoElement.videoHeight
|
||||
if (!width || !height) {
|
||||
throw new Error('Invalid video dimensions')
|
||||
}
|
||||
|
||||
const firstInit = !canvasElement._upscalerTransferred
|
||||
|
||||
let offscreen = null
|
||||
if (firstInit) {
|
||||
canvasElement.width = width * scale;
|
||||
canvasElement.height = height * scale;
|
||||
canvasElement.width = width * scale
|
||||
canvasElement.height = height * scale
|
||||
|
||||
if (typeof canvasElement.transferControlToOffscreen !== "function") {
|
||||
throw new Error("OffscreenCanvas is not supported in this environment");
|
||||
if (typeof canvasElement.transferControlToOffscreen !== 'function') {
|
||||
throw new TypeError('OffscreenCanvas is not supported in this environment')
|
||||
}
|
||||
|
||||
offscreen = canvasElement.transferControlToOffscreen();
|
||||
canvasElement._upscalerTransferred = true;
|
||||
offscreen = canvasElement.transferControlToOffscreen()
|
||||
canvasElement._upscalerTransferred = true
|
||||
}
|
||||
|
||||
const captureCanvas = document.createElement("canvas");
|
||||
captureCanvas.width = width;
|
||||
captureCanvas.height = height;
|
||||
const captureCtx = captureCanvas.getContext("2d");
|
||||
const captureCanvas = document.createElement('canvas')
|
||||
captureCanvas.width = width
|
||||
captureCanvas.height = height
|
||||
const captureCtx = captureCanvas.getContext('2d')
|
||||
|
||||
if (this.realtimeLoopId) {
|
||||
cancelAnimationFrame(this.realtimeLoopId);
|
||||
this.realtimeLoopId = null;
|
||||
cancelAnimationFrame(this.realtimeLoopId)
|
||||
this.realtimeLoopId = null
|
||||
}
|
||||
|
||||
const initPayload = {
|
||||
cmd: "realtimeInit",
|
||||
cmd: 'realtimeInit',
|
||||
data: {
|
||||
upscaled: firstInit ? offscreen : null,
|
||||
resolution: {
|
||||
@@ -456,12 +466,13 @@ export default class Upscaler {
|
||||
network_name: network.name,
|
||||
weights,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
if (firstInit && offscreen) {
|
||||
this.getWorker().postMessage(initPayload, [offscreen]);
|
||||
} else {
|
||||
this.getWorker().postMessage(initPayload);
|
||||
this.getWorker().postMessage(initPayload, [offscreen])
|
||||
}
|
||||
else {
|
||||
this.getWorker().postMessage(initPayload)
|
||||
}
|
||||
|
||||
this.realtimeState = {
|
||||
@@ -473,113 +484,121 @@ export default class Upscaler {
|
||||
frameIndex: 0,
|
||||
captureCanvas,
|
||||
captureCtx,
|
||||
};
|
||||
}
|
||||
|
||||
const loop = async () => {
|
||||
if (!this.realtimeState || !this.realtimeState.running) return;
|
||||
const state = this.realtimeState;
|
||||
const v = state.video;
|
||||
if (!this.realtimeState || !this.realtimeState.running)
|
||||
return
|
||||
const state = this.realtimeState
|
||||
const v = state.video
|
||||
|
||||
const haveCurrentData = v.HAVE_CURRENT_DATA || 2;
|
||||
const haveCurrentData = v.HAVE_CURRENT_DATA || 2
|
||||
|
||||
if (
|
||||
!v.paused &&
|
||||
!v.ended &&
|
||||
!state.busy &&
|
||||
v.readyState >= haveCurrentData &&
|
||||
v.videoWidth > 0 &&
|
||||
v.videoHeight > 0
|
||||
!v.paused
|
||||
&& !v.ended
|
||||
&& !state.busy
|
||||
&& v.readyState >= haveCurrentData
|
||||
&& v.videoWidth > 0
|
||||
&& v.videoHeight > 0
|
||||
) {
|
||||
state.busy = true;
|
||||
state.busy = true
|
||||
try {
|
||||
const captureCanvas = state.captureCanvas;
|
||||
const captureCtx = state.captureCtx;
|
||||
const captureCanvas = state.captureCanvas
|
||||
const captureCtx = state.captureCtx
|
||||
if (!captureCanvas || !captureCtx) {
|
||||
throw new Error("Missing capture canvas");
|
||||
throw new Error('Missing capture canvas')
|
||||
}
|
||||
captureCtx.drawImage(v, 0, 0, captureCanvas.width, captureCanvas.height);
|
||||
const frame = await createImageBitmap(captureCanvas);
|
||||
state.frameIndex += 1;
|
||||
captureCtx.drawImage(v, 0, 0, captureCanvas.width, captureCanvas.height)
|
||||
const frame = await createImageBitmap(captureCanvas)
|
||||
state.frameIndex += 1
|
||||
|
||||
this.getWorker().postMessage(
|
||||
{
|
||||
cmd: "realtimeFrame",
|
||||
cmd: 'realtimeFrame',
|
||||
frame,
|
||||
},
|
||||
[frame],
|
||||
);
|
||||
} catch (e) {
|
||||
console.warn("realtimeFrame error", e);
|
||||
} finally {
|
||||
)
|
||||
}
|
||||
catch (e) {
|
||||
console.warn('realtimeFrame error', e)
|
||||
}
|
||||
finally {
|
||||
if (this.realtimeState) {
|
||||
this.realtimeState.busy = false;
|
||||
this.realtimeState.busy = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.realtimeLoopId = requestAnimationFrame(loop);
|
||||
};
|
||||
this.realtimeLoopId = requestAnimationFrame(loop)
|
||||
}
|
||||
|
||||
this.realtimeLoopId = requestAnimationFrame(loop);
|
||||
this.realtimeLoopId = requestAnimationFrame(loop)
|
||||
}
|
||||
|
||||
stopRealtimeUpscale() {
|
||||
if (this.realtimeLoopId) {
|
||||
cancelAnimationFrame(this.realtimeLoopId);
|
||||
this.realtimeLoopId = null;
|
||||
cancelAnimationFrame(this.realtimeLoopId)
|
||||
this.realtimeLoopId = null
|
||||
}
|
||||
if (this.realtimeState) {
|
||||
this.realtimeState.running = false;
|
||||
this.realtimeState = null;
|
||||
this.realtimeState.running = false
|
||||
this.realtimeState = null
|
||||
}
|
||||
}
|
||||
|
||||
async downloadUpscaled(file, networkSize, filename = null) {
|
||||
const isVideo = file.type.startsWith("video");
|
||||
const size = networkSize || this.networkSize;
|
||||
const isVideo = file.type.startsWith('video')
|
||||
const size = networkSize || this.networkSize
|
||||
const blob = isVideo
|
||||
? await this.upscaleVideo(file, size)
|
||||
: await this.upscaleImage(file, size);
|
||||
const url = URL.createObjectURL(blob);
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.download =
|
||||
filename || `upscaled_${Date.now()}.${isVideo ? "mp4" : "png"}`;
|
||||
link.click();
|
||||
URL.revokeObjectURL(url);
|
||||
return blob;
|
||||
: await this.upscaleImage(file, size)
|
||||
const url = URL.createObjectURL(blob)
|
||||
const link = document.createElement('a')
|
||||
link.href = url
|
||||
link.download
|
||||
= filename || `upscaled_${Date.now()}.${isVideo ? 'mp4' : 'png'}`
|
||||
link.click()
|
||||
URL.revokeObjectURL(url)
|
||||
return blob
|
||||
}
|
||||
|
||||
getSupportedNetworks() {
|
||||
return Object.keys(this.networks);
|
||||
return Object.keys(this.networks)
|
||||
}
|
||||
|
||||
static async getGPUCapability() {
|
||||
try {
|
||||
if (navigator.gpu) {
|
||||
const adapter = await navigator.gpu.requestAdapter();
|
||||
const adapter = await navigator.gpu.requestAdapter()
|
||||
if (adapter) {
|
||||
const buffer = adapter.limits.maxStorageBufferBindingSize / 512;
|
||||
const texture = 8192 * 8192;
|
||||
return Math.min(buffer, texture);
|
||||
const buffer = adapter.limits.maxStorageBufferBindingSize / 512
|
||||
const texture = 8192 * 8192
|
||||
return Math.min(buffer, texture)
|
||||
}
|
||||
}
|
||||
const canvas = document.createElement("canvas");
|
||||
const gl = canvas.getContext("webgl2");
|
||||
if (gl) return gl.getParameter(gl.MAX_TEXTURE_SIZE) ** 2;
|
||||
return 8388608;
|
||||
} catch {
|
||||
return 8388608;
|
||||
const canvas = document.createElement('canvas')
|
||||
const gl = canvas.getContext('webgl2')
|
||||
if (gl)
|
||||
return gl.getParameter(gl.MAX_TEXTURE_SIZE) ** 2
|
||||
return 8388608
|
||||
}
|
||||
catch {
|
||||
return 8388608
|
||||
}
|
||||
}
|
||||
|
||||
static getBackendType() {
|
||||
try {
|
||||
if (navigator.gpu) return "webgpu";
|
||||
if (document.createElement("canvas").getContext("webgl2")) return "webgl";
|
||||
return "unknown";
|
||||
} catch {
|
||||
return "unknown";
|
||||
if (navigator.gpu)
|
||||
return 'webgpu'
|
||||
if (document.createElement('canvas').getContext('webgl2'))
|
||||
return 'webgl'
|
||||
return 'unknown'
|
||||
}
|
||||
catch {
|
||||
return 'unknown'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -590,24 +609,24 @@ export default class Upscaler {
|
||||
progress: 0,
|
||||
width: 0,
|
||||
height: 0,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
onProgress(callback) {
|
||||
if (typeof callback === "function") {
|
||||
this.progressCallback = callback;
|
||||
if (typeof callback === 'function') {
|
||||
this.progressCallback = callback
|
||||
}
|
||||
}
|
||||
|
||||
dispose() {
|
||||
this.stopRealtimeUpscale();
|
||||
this.stopRealtimeUpscale()
|
||||
if (this.workerInstance) {
|
||||
this.workerInstance.terminate();
|
||||
this.workerInstance = null;
|
||||
this.workerInstance.terminate()
|
||||
this.workerInstance = null
|
||||
}
|
||||
this.messageHandlers = {};
|
||||
this.progressCallback = null;
|
||||
this.processingType = null;
|
||||
this.weightsCache.clear();
|
||||
this.messageHandlers = {}
|
||||
this.progressCallback = null
|
||||
this.processingType = null
|
||||
this.weightsCache.clear()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,243 +1,254 @@
|
||||
import Upscaler from "./Upscaler.js";
|
||||
import Upscaler from './Upscaler.js'
|
||||
|
||||
function artplayerPluginWebsr(
|
||||
option = {
|
||||
networkSize: "medium",
|
||||
compare: false,
|
||||
weightsBaseUrl: "/weights",
|
||||
workerUrl: "/worker/main.js",
|
||||
videoScale: 2,
|
||||
},
|
||||
option = {
|
||||
networkSize: 'medium',
|
||||
compare: false,
|
||||
weightsBaseUrl: '/weights',
|
||||
workerUrl: '/worker/main.js',
|
||||
videoScale: 2,
|
||||
},
|
||||
) {
|
||||
return (art) => {
|
||||
const { $video, $player } = art.template;
|
||||
return (art) => {
|
||||
const { $video, $player } = art.template
|
||||
|
||||
const $canvas = document.createElement("canvas");
|
||||
$player.appendChild($canvas);
|
||||
const $canvas = document.createElement('canvas')
|
||||
$player.appendChild($canvas)
|
||||
|
||||
$canvas.style.position = "absolute";
|
||||
$canvas.style.zIndex = "11";
|
||||
$canvas.style.pointerEvents = "none";
|
||||
$canvas.style.top = "50%";
|
||||
$canvas.style.left = "50%";
|
||||
$canvas.style.transform = "translate(-50%, -50%)";
|
||||
$canvas.style.opacity = "0";
|
||||
$canvas.style.transition = "opacity 0.2s ease";
|
||||
$canvas.style.position = 'absolute'
|
||||
$canvas.style.zIndex = '11'
|
||||
$canvas.style.pointerEvents = 'none'
|
||||
$canvas.style.top = '50%'
|
||||
$canvas.style.left = '50%'
|
||||
$canvas.style.transform = 'translate(-50%, -50%)'
|
||||
$canvas.style.opacity = '0'
|
||||
$canvas.style.transition = 'opacity 0.2s ease'
|
||||
|
||||
function calcCanvasSize() {
|
||||
const videoElement = art.video;
|
||||
const containerWidth = $player.offsetWidth || 640;
|
||||
const containerHeight = $player.offsetHeight || 360;
|
||||
const videoWidth = videoElement.videoWidth || 640;
|
||||
const videoHeight = videoElement.videoHeight || 360;
|
||||
const aspectRatio = videoWidth / videoHeight;
|
||||
let displayWidth = containerWidth;
|
||||
let displayHeight = containerHeight;
|
||||
if (containerWidth / containerHeight > aspectRatio) {
|
||||
displayWidth = containerHeight * aspectRatio;
|
||||
} else {
|
||||
displayHeight = containerWidth / aspectRatio;
|
||||
}
|
||||
return { displayWidth, displayHeight };
|
||||
}
|
||||
function calcCanvasSize() {
|
||||
const videoElement = art.video
|
||||
const containerWidth = $player.offsetWidth || 640
|
||||
const containerHeight = $player.offsetHeight || 360
|
||||
const videoWidth = videoElement.videoWidth || 640
|
||||
const videoHeight = videoElement.videoHeight || 360
|
||||
const aspectRatio = videoWidth / videoHeight
|
||||
let displayWidth = containerWidth
|
||||
let displayHeight = containerHeight
|
||||
if (containerWidth / containerHeight > aspectRatio) {
|
||||
displayWidth = containerHeight * aspectRatio
|
||||
}
|
||||
else {
|
||||
displayHeight = containerWidth / aspectRatio
|
||||
}
|
||||
return { displayWidth, displayHeight }
|
||||
}
|
||||
|
||||
if (!Upscaler || !Upscaler.isSupported || !Upscaler.isSupported()) {
|
||||
console.warn("Upscaler is not supported in this environment");
|
||||
return;
|
||||
}
|
||||
if (!Upscaler || !Upscaler.isSupported || !Upscaler.isSupported()) {
|
||||
console.warn('Upscaler is not supported in this environment')
|
||||
return
|
||||
}
|
||||
|
||||
const upscaler = new Upscaler({
|
||||
networkSize: option.networkSize || "medium",
|
||||
weightsBaseUrl: option.weightsBaseUrl || "/weights",
|
||||
workerUrl: option.workerUrl || "/worker/main.js",
|
||||
videoScale: option.videoScale || 2,
|
||||
});
|
||||
const upscaler = new Upscaler({
|
||||
networkSize: option.networkSize || 'medium',
|
||||
weightsBaseUrl: option.weightsBaseUrl || '/weights',
|
||||
workerUrl: option.workerUrl || '/worker/main.js',
|
||||
videoScale: option.videoScale || 2,
|
||||
})
|
||||
|
||||
let realtimeStarted = false;
|
||||
let realtimeStarted = false
|
||||
|
||||
async function startRealtime() {
|
||||
if (realtimeStarted) return;
|
||||
realtimeStarted = true;
|
||||
async function startRealtime() {
|
||||
if (realtimeStarted)
|
||||
return
|
||||
realtimeStarted = true
|
||||
|
||||
try {
|
||||
await new Promise((resolve, reject) => {
|
||||
if ($video.readyState >= 1) {
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
const onLoaded = () => {
|
||||
cleanup();
|
||||
resolve();
|
||||
};
|
||||
const onError = () => {
|
||||
cleanup();
|
||||
reject(new Error("Failed to load video metadata"));
|
||||
};
|
||||
const cleanup = () => {
|
||||
$video.removeEventListener("loadedmetadata", onLoaded);
|
||||
$video.removeEventListener("error", onError);
|
||||
};
|
||||
$video.addEventListener("loadedmetadata", onLoaded);
|
||||
$video.addEventListener("error", onError);
|
||||
});
|
||||
try {
|
||||
await new Promise((resolve, reject) => {
|
||||
if ($video.readyState >= 1) {
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
let onLoaded, onError
|
||||
const cleanup = () => {
|
||||
$video.removeEventListener('loadedmetadata', onLoaded)
|
||||
$video.removeEventListener('error', onError)
|
||||
}
|
||||
onLoaded = () => {
|
||||
cleanup()
|
||||
resolve()
|
||||
}
|
||||
onError = () => {
|
||||
cleanup()
|
||||
reject(new Error('Failed to load video metadata'))
|
||||
}
|
||||
$video.addEventListener('loadedmetadata', onLoaded)
|
||||
$video.addEventListener('error', onError)
|
||||
})
|
||||
|
||||
await upscaler.startRealtimeUpscale(
|
||||
$video,
|
||||
$canvas,
|
||||
option.networkSize || upscaler.networkSize,
|
||||
);
|
||||
await upscaler.startRealtimeUpscale(
|
||||
$video,
|
||||
$canvas,
|
||||
option.networkSize || upscaler.networkSize,
|
||||
)
|
||||
|
||||
requestAnimationFrame(() => {
|
||||
$canvas.style.opacity = "1";
|
||||
});
|
||||
} catch (e) {
|
||||
console.error(
|
||||
"artplayer-plugin-upscaler: failed to start realtime",
|
||||
e,
|
||||
);
|
||||
}
|
||||
}
|
||||
requestAnimationFrame(() => {
|
||||
$canvas.style.opacity = '1'
|
||||
})
|
||||
}
|
||||
catch (e) {
|
||||
console.error(
|
||||
'artplayer-plugin-upscaler: failed to start realtime',
|
||||
e,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
const { displayWidth, displayHeight } = calcCanvasSize();
|
||||
$canvas.style.width = displayWidth + "px";
|
||||
$canvas.style.height = displayHeight + "px";
|
||||
const { displayWidth, displayHeight } = calcCanvasSize()
|
||||
$canvas.style.width = `${displayWidth}px`
|
||||
$canvas.style.height = `${displayHeight}px`
|
||||
|
||||
let comparePosition = 50;
|
||||
let isDragging = false;
|
||||
let compareEnabled = !!option.compare;
|
||||
let comparePosition = 50
|
||||
let isDragging = false
|
||||
let compareEnabled = !!option.compare
|
||||
|
||||
const $handler = document.createElement("div");
|
||||
$handler.style.position = "absolute";
|
||||
$handler.style.width = "3px";
|
||||
$handler.style.backgroundColor = "rgba(255, 255, 255, 0.75)";
|
||||
$handler.style.cursor = "ew-resize";
|
||||
$handler.style.zIndex = "12";
|
||||
$handler.style.pointerEvents = "auto";
|
||||
$handler.style.display = compareEnabled ? "block" : "none";
|
||||
$handler.style.boxShadow = "0 0 2px rgba(0, 0, 0, 0.1)";
|
||||
const $handler = document.createElement('div')
|
||||
$handler.style.position = 'absolute'
|
||||
$handler.style.width = '3px'
|
||||
$handler.style.backgroundColor = 'rgba(255, 255, 255, 0.75)'
|
||||
$handler.style.cursor = 'ew-resize'
|
||||
$handler.style.zIndex = '12'
|
||||
$handler.style.pointerEvents = 'auto'
|
||||
$handler.style.display = compareEnabled ? 'block' : 'none'
|
||||
$handler.style.boxShadow = '0 0 2px rgba(0, 0, 0, 0.1)'
|
||||
|
||||
if (compareEnabled) {
|
||||
$player.appendChild($handler)
|
||||
$handler.addEventListener('mousedown', handleMouseDown)
|
||||
document.addEventListener('mousemove', handleMouseMove)
|
||||
document.addEventListener('mouseup', handleMouseUp)
|
||||
updateCompareMask()
|
||||
}
|
||||
|
||||
function updateCompareMask() {
|
||||
if (compareEnabled) {
|
||||
const { displayWidth, displayHeight } = calcCanvasSize()
|
||||
const gradient = `linear-gradient(to right, transparent 0%, transparent ${comparePosition}%, black ${comparePosition}%, black 100%)`
|
||||
$canvas.style.maskImage = gradient
|
||||
|
||||
const containerWidth = $player.offsetWidth || 640
|
||||
const containerHeight = $player.offsetHeight || 360
|
||||
const canvasLeft = (containerWidth - displayWidth) / 2
|
||||
const canvasTop = (containerHeight - displayHeight) / 2
|
||||
const handlerX
|
||||
= canvasLeft + (displayWidth * comparePosition) / 100
|
||||
|
||||
$handler.style.top = `${canvasTop}px`
|
||||
$handler.style.left = `${handlerX}px`
|
||||
$handler.style.height = `${displayHeight}px`
|
||||
$handler.style.transform = 'translateX(-50%)'
|
||||
}
|
||||
else {
|
||||
$canvas.style.maskImage = 'none'
|
||||
}
|
||||
}
|
||||
|
||||
function handleMouseDown(_e) {
|
||||
if (compareEnabled) {
|
||||
isDragging = true
|
||||
}
|
||||
}
|
||||
|
||||
function handleMouseMove(e) {
|
||||
if (compareEnabled && isDragging) {
|
||||
const rect = $player.getBoundingClientRect()
|
||||
const { displayWidth } = calcCanvasSize()
|
||||
const containerWidth = $player.offsetWidth || 640
|
||||
const canvasLeft = (containerWidth - displayWidth) / 2
|
||||
const x = e.clientX - rect.left
|
||||
const relativeX = x - canvasLeft
|
||||
comparePosition = (relativeX / displayWidth) * 100
|
||||
comparePosition = Math.max(0, Math.min(100, comparePosition))
|
||||
updateCompareMask()
|
||||
}
|
||||
}
|
||||
|
||||
function handleMouseUp(_e) {
|
||||
isDragging = false
|
||||
}
|
||||
|
||||
art.on('destroy', () => {
|
||||
if (upscaler && typeof upscaler.dispose === 'function') {
|
||||
upscaler.dispose()
|
||||
}
|
||||
$handler.removeEventListener('mousedown', handleMouseDown)
|
||||
document.removeEventListener('mousemove', handleMouseMove)
|
||||
document.removeEventListener('mouseup', handleMouseUp)
|
||||
})
|
||||
|
||||
art.on('resize', () => {
|
||||
const { displayWidth, displayHeight } = calcCanvasSize()
|
||||
$canvas.style.width = `${displayWidth}px`
|
||||
$canvas.style.height = `${displayHeight}px`
|
||||
updateCompareMask()
|
||||
})
|
||||
|
||||
art.on('play', () => {
|
||||
startRealtime()
|
||||
})
|
||||
|
||||
function update(newOption = {}) {
|
||||
if (!newOption || typeof newOption !== 'object')
|
||||
return
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(newOption, 'compare')) {
|
||||
const nextCompare = !!newOption.compare
|
||||
option.compare = nextCompare
|
||||
compareEnabled = nextCompare
|
||||
|
||||
if (compareEnabled) {
|
||||
$player.appendChild($handler);
|
||||
$handler.addEventListener("mousedown", handleMouseDown);
|
||||
document.addEventListener("mousemove", handleMouseMove);
|
||||
document.addEventListener("mouseup", handleMouseUp);
|
||||
updateCompareMask();
|
||||
if (!$handler.parentNode) {
|
||||
$player.appendChild($handler)
|
||||
}
|
||||
$handler.style.display = 'block'
|
||||
$handler.addEventListener('mousedown', handleMouseDown)
|
||||
document.addEventListener('mousemove', handleMouseMove)
|
||||
document.addEventListener('mouseup', handleMouseUp)
|
||||
updateCompareMask()
|
||||
}
|
||||
|
||||
function updateCompareMask() {
|
||||
if (compareEnabled) {
|
||||
const { displayWidth, displayHeight } = calcCanvasSize();
|
||||
const gradient = `linear-gradient(to right, transparent 0%, transparent ${comparePosition}%, black ${comparePosition}%, black 100%)`;
|
||||
$canvas.style.maskImage = gradient;
|
||||
|
||||
const containerWidth = $player.offsetWidth || 640;
|
||||
const containerHeight = $player.offsetHeight || 360;
|
||||
const canvasLeft = (containerWidth - displayWidth) / 2;
|
||||
const canvasTop = (containerHeight - displayHeight) / 2;
|
||||
const handlerX =
|
||||
canvasLeft + (displayWidth * comparePosition) / 100;
|
||||
|
||||
$handler.style.top = canvasTop + "px";
|
||||
$handler.style.left = handlerX + "px";
|
||||
$handler.style.height = displayHeight + "px";
|
||||
$handler.style.transform = "translateX(-50%)";
|
||||
} else {
|
||||
$canvas.style.maskImage = "none";
|
||||
}
|
||||
else {
|
||||
$canvas.style.maskImage = 'none'
|
||||
$handler.style.display = 'none'
|
||||
$handler.removeEventListener('mousedown', handleMouseDown)
|
||||
document.removeEventListener('mousemove', handleMouseMove)
|
||||
document.removeEventListener('mouseup', handleMouseUp)
|
||||
}
|
||||
}
|
||||
|
||||
function handleMouseDown(e) {
|
||||
if (compareEnabled) {
|
||||
isDragging = true;
|
||||
}
|
||||
if (newOption.networkSize) {
|
||||
const nextSize = newOption.networkSize
|
||||
option.networkSize = nextSize
|
||||
if (
|
||||
upscaler
|
||||
&& typeof upscaler.stopRealtimeUpscale === 'function'
|
||||
) {
|
||||
upscaler.stopRealtimeUpscale()
|
||||
}
|
||||
|
||||
function handleMouseMove(e) {
|
||||
if (compareEnabled && isDragging) {
|
||||
const rect = $player.getBoundingClientRect();
|
||||
const { displayWidth } = calcCanvasSize();
|
||||
const containerWidth = $player.offsetWidth || 640;
|
||||
const canvasLeft = (containerWidth - displayWidth) / 2;
|
||||
const x = e.clientX - rect.left;
|
||||
const relativeX = x - canvasLeft;
|
||||
comparePosition = (relativeX / displayWidth) * 100;
|
||||
comparePosition = Math.max(0, Math.min(100, comparePosition));
|
||||
updateCompareMask();
|
||||
}
|
||||
realtimeStarted = false
|
||||
if (!art.paused) {
|
||||
startRealtime()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function handleMouseUp(e) {
|
||||
isDragging = false;
|
||||
}
|
||||
|
||||
art.on("destroy", () => {
|
||||
if (upscaler && typeof upscaler.dispose === "function") {
|
||||
upscaler.dispose();
|
||||
}
|
||||
$handler.removeEventListener("mousedown", handleMouseDown);
|
||||
document.removeEventListener("mousemove", handleMouseMove);
|
||||
document.removeEventListener("mouseup", handleMouseUp);
|
||||
});
|
||||
|
||||
art.on("resize", () => {
|
||||
const { displayWidth, displayHeight } = calcCanvasSize();
|
||||
$canvas.style.width = displayWidth + "px";
|
||||
$canvas.style.height = displayHeight + "px";
|
||||
updateCompareMask();
|
||||
});
|
||||
|
||||
art.on("play", () => {
|
||||
startRealtime();
|
||||
});
|
||||
|
||||
function update(newOption = {}) {
|
||||
if (!newOption || typeof newOption !== "object") return;
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(newOption, "compare")) {
|
||||
const nextCompare = !!newOption.compare;
|
||||
option.compare = nextCompare;
|
||||
compareEnabled = nextCompare;
|
||||
|
||||
if (compareEnabled) {
|
||||
if (!$handler.parentNode) {
|
||||
$player.appendChild($handler);
|
||||
}
|
||||
$handler.style.display = "block";
|
||||
$handler.addEventListener("mousedown", handleMouseDown);
|
||||
document.addEventListener("mousemove", handleMouseMove);
|
||||
document.addEventListener("mouseup", handleMouseUp);
|
||||
updateCompareMask();
|
||||
} else {
|
||||
$canvas.style.maskImage = "none";
|
||||
$handler.style.display = "none";
|
||||
$handler.removeEventListener("mousedown", handleMouseDown);
|
||||
document.removeEventListener("mousemove", handleMouseMove);
|
||||
document.removeEventListener("mouseup", handleMouseUp);
|
||||
}
|
||||
}
|
||||
|
||||
if (newOption.networkSize) {
|
||||
const nextSize = newOption.networkSize;
|
||||
option.networkSize = nextSize;
|
||||
if (
|
||||
upscaler &&
|
||||
typeof upscaler.stopRealtimeUpscale === "function"
|
||||
) {
|
||||
upscaler.stopRealtimeUpscale();
|
||||
}
|
||||
realtimeStarted = false;
|
||||
if (!art.paused) {
|
||||
startRealtime();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
name: "artplayerPluginWebsr",
|
||||
upscaler,
|
||||
update,
|
||||
};
|
||||
};
|
||||
return {
|
||||
name: 'artplayerPluginWebsr',
|
||||
upscaler,
|
||||
update,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
window.artplayerPluginWebsr = artplayerPluginWebsr;
|
||||
if (typeof window !== 'undefined') {
|
||||
window.artplayerPluginWebsr = artplayerPluginWebsr
|
||||
}
|
||||
|
||||
export default artplayerPluginWebsr
|
||||
@@ -1,19 +1,19 @@
|
||||
import type Artplayer from 'artplayer';
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
interface Option {
|
||||
compare?: boolean;
|
||||
networkSize?: 'small' | 'medium' | 'large';
|
||||
weightsBaseUrl?: string;
|
||||
workerUrl?: string;
|
||||
videoScale?: number;
|
||||
compare?: boolean
|
||||
networkSize?: 'small' | 'medium' | 'large'
|
||||
weightsBaseUrl?: string
|
||||
workerUrl?: string
|
||||
videoScale?: number
|
||||
}
|
||||
|
||||
interface Result {
|
||||
name: 'artplayerPluginWebsr';
|
||||
upscaler: any;
|
||||
update: (option: Option) => void;
|
||||
name: 'artplayerPluginWebsr'
|
||||
upscaler: any
|
||||
update: (option: Option) => void
|
||||
}
|
||||
|
||||
declare const artplayerPluginWebsr: (option?: Option) => (art: Artplayer) => Result;
|
||||
declare const artplayerPluginWebsr: (option?: Option) => (art: Artplayer) => Result
|
||||
|
||||
export default artplayerPluginWebsr
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-proxy-canvas.js v1.0.0
|
||||
* artplayer-proxy-canvas.js v1.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,n,o){var i="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},a="function"==typeof i[n]&&i[n],u=a.i||{},f=a.cache||{},l="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,r){if(!f[t]){if(!e[t]){if(o[t])return o[t];var u="function"==typeof i[n]&&i[n];if(!r&&u)return u(t,!0);if(a)return a(t,!0);if(l&&"string"==typeof t)return l(t);var d=Error("Cannot find module '"+t+"'");throw d.code="MODULE_NOT_FOUND",d}p.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},p.cache={};var s=f[t]=new c.Module(t);e[t][0].call(s.exports,p,s,s.exports,i)}return f[t].exports;function p(e){var t=p.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=c(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 c(t)}}c.isParcelRequire=!0,c.Module=function(e){this.id=e,this.bundle=c,this.require=l,this.exports={}},c.modules=e,c.cache=f,c.parent=a,c.distDir=void 0,c.publicUrl=void 0,c.devServer=void 0,c.i=u,c.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(c,"root",{get:function(){return i[n]}}),i[n]=c;for(var d=0;d<t.length;d++)c(t[d]);if(r){var s=c(r);"object"==typeof exports&&"u">typeof module?module.exports=s:"function"==typeof define&&define.amd&&define(function(){return s})}}({fsIOq:[function(e,t,r,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");function i(e){return t=>{let{constructor:r}=t,{createElement:n}=r.utils,o=n("canvas"),i=n("video"),a=o.getContext("2d"),u=null,f={};for(let e in o)"function"==typeof o[e]&&(f[e]=o[e].bind(o));for(let e in i)e in o||Object.defineProperty(o,e,{get(){let t=i[e];return"function"==typeof t?t.bind(i):t},set(t){i[e]=t},configurable:!0,enumerable:!0});for(let e in f)o[e]=function(...t){return e in f?f[e](...t):i[e](...t)};return function(){let{events:e}=r.config;setTimeout(()=>{e.forEach(e=>{t.proxy(i,e,e=>{t.emit(`video:${e.type}`,e)})})})}(),t.on("video:loadedmetadata",()=>{o.width=i.videoWidth,o.height=i.videoHeight}),t.on("video:play",()=>{cancelAnimationFrame(u),c()}),t.on("video:pause",()=>{cancelAnimationFrame(u)}),t.on("resize",()=>{!function(){let e,r,n=t.template?.$player;if(!n||t.option.autoSize)return;let a=i.videoWidth/i.videoHeight,u=n.clientWidth,f=n.clientHeight;u/f>a?e=(r=f)*a:r=(e=u)/a,o.width=e,o.height=r;let l=(u-e)/2,c=(f-r)/2;Object.assign(o.style,{padding:`${c}px ${l}px`})}(),l()}),t.on("destroy",()=>{cancelAnimationFrame(u)}),o;async function l(){try{if("u">typeof createImageBitmap){let e=await createImageBitmap(i);a.drawImage(e,0,0,o.width,o.height),e.close()}else a.drawImage(i,0,0,o.width,o.height);e&&e(a,i),t.emit("artplayerProxyCanvas:draw",a,i)}catch(e){t.emit("artplayerProxyCanvas:error",e)}}async function c(){await l(),u=requestAnimationFrame(c)}}}o.defineInteropFlag(r),o.export(r,"default",()=>i),"u">typeof window&&(window.artplayerProxyCanvas=i)},{"@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"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})}},{}]},["fsIOq"],"fsIOq","parcelRequire4dc0",{});
|
||||
!function(e,t){"object"===typeof exports&&"undefined"!==typeof module?module.exports=t():"function"==typeof define&&define.amd?(t.ArtplayerProxyCanvas=t(),define(function(){return t.ArtplayerProxyCanvas})):(e="undefined"!==typeof globalThis?globalThis:e||self).ArtplayerProxyCanvas=t()}(this,function(){"use strict";function e(e){return t=>{const{constructor:n}=t,{createElement:i}=n.utils,o=i("canvas"),a=i("video"),r=o.getContext("2d");let c=null;const d={};for(const e in o)"function"===typeof o[e]&&(d[e]=o[e].bind(o));for(const e in a)e in o||Object.defineProperty(o,e,{get(){const t=a[e];return"function"===typeof t?t.bind(a):t},set(t){a[e]=t},configurable:!0,enumerable:!0});for(const e in d)o[e]=function(...t){return e in d?d[e](...t):a[e](...t)};return function(){const{events:e}=n.config;setTimeout(()=>{e.forEach(e=>{t.proxy(a,e,e=>{t.emit(`video:${e.type}`,e)})})})}(),t.on("video:loadedmetadata",()=>{o.width=a.videoWidth,o.height=a.videoHeight}),t.on("video:play",()=>{cancelAnimationFrame(c),f()}),t.on("video:pause",()=>{cancelAnimationFrame(c)}),t.on("resize",()=>{!function(){const e=t.template?.$player;if(!e||t.option.autoSize)return;const n=a.videoWidth/a.videoHeight,i=e.clientWidth,r=e.clientHeight;let c,d;i/r>n?(d=r,c=d*n):(c=i,d=c/n),o.width=c,o.height=d;const s=(i-c)/2,f=(r-d)/2;Object.assign(o.style,{padding:`${f}px ${s}px`})}(),s()}),t.on("destroy",()=>{cancelAnimationFrame(c)}),o;async function s(){try{if("undefined"!==typeof createImageBitmap){const e=await createImageBitmap(a);r.drawImage(e,0,0,o.width,o.height),e.close()}else r.drawImage(a,0,0,o.width,o.height);e&&e(r,a),t.emit("artplayerProxyCanvas:draw",r,a)}catch(n){t.emit("artplayerProxyCanvas:error",n)}}async function f(){await s(),c=requestAnimationFrame(f)}}}return"undefined"!==typeof window&&(window.artplayerProxyCanvas=e),e});
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-proxy-canvas.js v1.0.0
|
||||
* artplayer-proxy-canvas.js v1.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,n,o){var i="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},c="function"==typeof i[n]&&i[n],a=c.i||{},u=c.cache||{},f="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function l(t,r){if(!u[t]){if(!e[t]){if(o[t])return o[t];var a="function"==typeof i[n]&&i[n];if(!r&&a)return a(t,!0);if(c)return c(t,!0);if(f&&"string"==typeof t)return f(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}p.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},p.cache={};var d=u[t]=new l.Module(t);e[t][0].call(d.exports,p,d,d.exports,i)}return u[t].exports;function p(e){var t=p.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=l(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 l(t)}}l.isParcelRequire=!0,l.Module=function(e){this.id=e,this.bundle=l,this.require=f,this.exports={}},l.modules=e,l.cache=u,l.parent=c,l.distDir=void 0,l.publicUrl=void 0,l.devServer=void 0,l.i=a,l.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(l,"root",{get:function(){return i[n]}}),i[n]=l;for(var s=0;s<t.length;s++)l(t[s]);if(r){var d=l(r);"object"==typeof exports&&"u">typeof module?module.exports=d:"function"==typeof define&&define.amd&&define(function(){return d})}}({LnyEn:[function(e,t,r,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"default",function(){return u});var i=e("@swc/helpers/cjs/_async_to_generator.cjs"),c=e("@swc/helpers/cjs/_to_consumable_array.cjs"),a=e("@swc/helpers/cjs/_ts_generator.cjs");function u(e){return function(t){var r,n=function(e){e in l||Object.defineProperty(l,e,{get:function(){var t=s[e];return"function"==typeof t?t.bind(s):t},set:function(t){s[e]=t},configurable:!0,enumerable:!0})},o=function(e){l[e]=function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return e in y?y[e].apply(y,(0,c._)(r)):s[e].apply(s,(0,c._)(r))}},u=t.constructor,f=u.utils.createElement,l=f("canvas"),s=f("video"),d=l.getContext("2d"),p=null,y={};for(var b in l)"function"==typeof l[b]&&(y[b]=l[b].bind(l));for(var h in s)n(h);for(var v in y)o(v);return r=u.config.events,setTimeout(function(){r.forEach(function(e){t.proxy(s,e,function(e){t.emit("video:".concat(e.type),e)})})}),t.on("video:loadedmetadata",function(){l.width=s.videoWidth,l.height=s.videoHeight}),t.on("video:play",function(){cancelAnimationFrame(p),function e(){return(0,i._)(function(){return(0,a._)(this,function(t){switch(t.label){case 0:return[4,m()];case 1:return t.sent(),p=requestAnimationFrame(e),[2]}})})()}()}),t.on("video:pause",function(){cancelAnimationFrame(p)}),t.on("resize",function(){!function(){var e,r,n,o=null==(e=t.template)?void 0:e.$player;if(o&&!t.option.autoSize){var i=s.videoWidth/s.videoHeight,c=o.clientWidth,a=o.clientHeight;c/a>i?r=(n=a)*i:n=(r=c)/i,l.width=r,l.height=n;var u=(c-r)/2,f=(a-n)/2;Object.assign(l.style,{padding:"".concat(f,"px ").concat(u,"px")})}}(),m()}),t.on("destroy",function(){cancelAnimationFrame(p)}),l;function m(){return(0,i._)(function(){var r,n;return(0,a._)(this,function(o){switch(o.label){case 0:if(o.trys.push([0,4,,5]),"u"<typeof createImageBitmap)return[3,2];return[4,createImageBitmap(s)];case 1:return r=o.sent(),d.drawImage(r,0,0,l.width,l.height),r.close(),[3,3];case 2:d.drawImage(s,0,0,l.width,l.height),o.label=3;case 3:return e&&e(d,s),t.emit("artplayerProxyCanvas:draw",d,s),[3,5];case 4:return n=o.sent(),t.emit("artplayerProxyCanvas:error",n),[3,5];case 5:return[2]}})})()}}}"u">typeof window&&(window.artplayerProxyCanvas=u)},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_to_consumable_array.cjs":"i81N6","@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)})}}},{}],i81N6:[function(e,t,r,n){"use strict";var o=e("d402183024004bc7"),i=e("3209e2b12672cd18"),c=e("fc58adb8f1bff142"),a=e("5e213dc122a10171");r._=function(e){return o._(e)||i._(e)||a._(e)||c._()}},{d402183024004bc7:"hfQG0","3209e2b12672cd18":"fQrlQ",fc58adb8f1bff142:"fWabh","5e213dc122a10171":"fh7mx"}],hfQG0:[function(e,t,r,n){"use strict";var o=e("5bd5b10bf87fc8e");r._=function(e){if(Array.isArray(e))return o._(e)}},Line truncated
|
||||
!function(e,t){"object"===typeof exports&&"undefined"!==typeof module?module.exports=t():"function"==typeof define&&define.amd?(t.ArtplayerProxyCanvas=t(),define(function(){return t.ArtplayerProxyCanvas})):(e="undefined"!==typeof globalThis?globalThis:e||self).ArtplayerProxyCanvas=t()}(this,function(){"use strict";var e=(e,t,n)=>new Promise((i,o)=>{var r=e=>{try{c(n.next(e))}catch(t){o(t)}},a=e=>{try{c(n.throw(e))}catch(t){o(t)}},c=e=>e.done?i(e.value):Promise.resolve(e.value).then(r,a);c((n=n.apply(e,t)).next())});function t(t){return n=>{const{constructor:i}=n,{createElement:o}=i.utils,r=o("canvas"),a=o("video"),c=r.getContext("2d");let d=null;const l={};for(const e in r)"function"===typeof r[e]&&(l[e]=r[e].bind(r));for(const e in a)e in r||Object.defineProperty(r,e,{get(){const t=a[e];return"function"===typeof t?t.bind(a):t},set(t){a[e]=t},configurable:!0,enumerable:!0});for(const e in l)r[e]=function(...t){return e in l?l[e](...t):a[e](...t)};return function(){const{events:e}=i.config;setTimeout(()=>{e.forEach(e=>{n.proxy(a,e,e=>{n.emit(`video:${e.type}`,e)})})})}(),n.on("video:loadedmetadata",()=>{r.width=a.videoWidth,r.height=a.videoHeight}),n.on("video:play",()=>{cancelAnimationFrame(d),u()}),n.on("video:pause",()=>{cancelAnimationFrame(d)}),n.on("resize",()=>{!function(){var e;const t=null==(e=n.template)?void 0:e.$player;if(!t||n.option.autoSize)return;const i=a.videoWidth/a.videoHeight,o=t.clientWidth,c=t.clientHeight;let d,l;o/c>i?(l=c,d=l*i):(d=o,l=d/i),r.width=d,r.height=l;const s=(o-d)/2,u=(c-l)/2;Object.assign(r.style,{padding:`${u}px ${s}px`})}(),s()}),n.on("destroy",()=>{cancelAnimationFrame(d)}),r;function s(){return e(this,null,function*(){try{if("undefined"!==typeof createImageBitmap){const e=yield createImageBitmap(a);c.drawImage(e,0,0,r.width,r.height),e.close()}else c.drawImage(a,0,0,r.width,r.height);t&&t(c,a),n.emit("artplayerProxyCanvas:draw",c,a)}catch(e){n.emit("artplayerProxyCanvas:error",e)}})}function u(){return e(this,null,function*(){yield s(),d=requestAnimationFrame(u)})}}}return"undefined"!==typeof window&&(window.artplayerProxyCanvas=t),t});
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-proxy-canvas.js v1.0.0
|
||||
* artplayer-proxy-canvas.js v1.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,n,o){var i="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},a="function"==typeof i[n]&&i[n],u=a.i||{},l=a.cache||{},f="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,r){if(!l[t]){if(!e[t]){if(o[t])return o[t];var u="function"==typeof i[n]&&i[n];if(!r&&u)return u(t,!0);if(a)return a(t,!0);if(f&&"string"==typeof t)return f(t);var d=Error("Cannot find module '"+t+"'");throw d.code="MODULE_NOT_FOUND",d}s.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},s.cache={};var p=l[t]=new c.Module(t);e[t][0].call(p.exports,s,p,p.exports,i)}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=c(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 c(t)}}c.isParcelRequire=!0,c.Module=function(e){this.id=e,this.bundle=c,this.require=f,this.exports={}},c.modules=e,c.cache=l,c.parent=a,c.distDir=void 0,c.publicUrl=void 0,c.devServer=void 0,c.i=u,c.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(c,"root",{get:function(){return i[n]}}),i[n]=c;for(var d=0;d<t.length;d++)c(t[d]);if(r){var p=c(r);"object"==typeof exports&&"u">typeof module?module.exports=p:"function"==typeof define&&define.amd&&define(function(){return p})}}({"7gEKL":[function(e,t,r,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");function i(e){return t=>{let{constructor:r}=t,{createElement:n}=r.utils,o=n("canvas"),i=n("video"),a=o.getContext("2d"),u=null,l={};for(let e in o)"function"==typeof o[e]&&(l[e]=o[e].bind(o));for(let e in i)e in o||Object.defineProperty(o,e,{get(){let t=i[e];return"function"==typeof t?t.bind(i):t},set(t){i[e]=t},configurable:!0,enumerable:!0});for(let e in l)o[e]=function(...t){return e in l?l[e](...t):i[e](...t)};return function(){let{events:e}=r.config;setTimeout(()=>{e.forEach(e=>{t.proxy(i,e,e=>{t.emit(`video:${e.type}`,e)})})})}(),t.on("video:loadedmetadata",()=>{o.width=i.videoWidth,o.height=i.videoHeight}),t.on("video:play",()=>{cancelAnimationFrame(u),c()}),t.on("video:pause",()=>{cancelAnimationFrame(u)}),t.on("resize",()=>{!function(){let e,r,n=t.template?.$player;if(!n||t.option.autoSize)return;let a=i.videoWidth/i.videoHeight,u=n.clientWidth,l=n.clientHeight;u/l>a?e=(r=l)*a:r=(e=u)/a,o.width=e,o.height=r;let f=(u-e)/2,c=(l-r)/2;Object.assign(o.style,{padding:`${c}px ${f}px`})}(),f()}),t.on("destroy",()=>{cancelAnimationFrame(u)}),o;async function f(){try{if("u">typeof createImageBitmap){let e=await createImageBitmap(i);a.drawImage(e,0,0,o.width,o.height),e.close()}else a.drawImage(i,0,0,o.width,o.height);e&&e(a,i),t.emit("artplayerProxyCanvas:draw",a,i)}catch(e){t.emit("artplayerProxyCanvas:error",e)}}async function c(){await f(),u=requestAnimationFrame(c)}}}o.defineInteropFlag(r),o.export(r,"default",()=>i),"u">typeof window&&(window.artplayerProxyCanvas=i)},{"@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})}},{}]},["7gEKL"],"7gEKL","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("7gEKL");export{e as default};
|
||||
function e(e){return t=>{const{constructor:n}=t,{createElement:i}=n.utils,o=i("canvas"),a=i("video"),r=o.getContext("2d");let c=null;const d={};for(const e in o)"function"===typeof o[e]&&(d[e]=o[e].bind(o));for(const e in a)e in o||Object.defineProperty(o,e,{get(){const t=a[e];return"function"===typeof t?t.bind(a):t},set(t){a[e]=t},configurable:!0,enumerable:!0});for(const e in d)o[e]=function(...t){return e in d?d[e](...t):a[e](...t)};return function(){const{events:e}=n.config;setTimeout(()=>{e.forEach(e=>{t.proxy(a,e,e=>{t.emit(`video:${e.type}`,e)})})})}(),t.on("video:loadedmetadata",()=>{o.width=a.videoWidth,o.height=a.videoHeight}),t.on("video:play",()=>{cancelAnimationFrame(c),u()}),t.on("video:pause",()=>{cancelAnimationFrame(c)}),t.on("resize",()=>{!function(){const e=t.template?.$player;if(!e||t.option.autoSize)return;const n=a.videoWidth/a.videoHeight,i=e.clientWidth,r=e.clientHeight;let c,d;i/r>n?(d=r,c=d*n):(c=i,d=c/n),o.width=c,o.height=d;const s=(i-c)/2,u=(r-d)/2;Object.assign(o.style,{padding:`${u}px ${s}px`})}(),s()}),t.on("destroy",()=>{cancelAnimationFrame(c)}),o;async function s(){try{if("undefined"!==typeof createImageBitmap){const e=await createImageBitmap(a);r.drawImage(e,0,0,o.width,o.height),e.close()}else r.drawImage(a,0,0,o.width,o.height);e&&e(r,a),t.emit("artplayerProxyCanvas:draw",r,a)}catch(n){t.emit("artplayerProxyCanvas:error",n)}}async function u(){await s(),c=requestAnimationFrame(u)}}}"undefined"!==typeof window&&(window.artplayerProxyCanvas=e);export{e as default};
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "artplayer-proxy-canvas",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "canvas proxy for ArtPlayer",
|
||||
"author": "Harvey Zhao <laozhaochaguan@gmail.com>",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-proxy-mediabunny.js v1.0.0
|
||||
* artplayer-proxy-mediabunny.js v1.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,a,i){var s="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},n="function"==typeof s[a]&&s[a],o=n.i||{},l=n.cache||{},c="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,r){if(!l[t]){if(!e[t]){if(i[t])return i[t];var o="function"==typeof s[a]&&s[a];if(!r&&o)return o(t,!0);if(n)return n(t,!0);if(c&&"string"==typeof t)return c(t);var u=Error("Cannot find module '"+t+"'");throw u.code="MODULE_NOT_FOUND",u}m.resolve=function(r){var a=e[t][1][r];return null!=a?a:r},m.cache={};var h=l[t]=new d.Module(t);e[t][0].call(h.exports,m,h,h.exports,s)}return l[t].exports;function m(e){var t=m.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],i=e[2]||e[0],s=d(a);"*"===t?Object.keys(s).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return s[e]}})}):"*"===i?Object.defineProperty(r,t,{enumerable:!0,value:s}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===i?s.__esModule?s.default:s:s[i]}})}),r}return d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.require=c,this.exports={}},d.modules=e,d.cache=l,d.parent=n,d.distDir=void 0,d.publicUrl=void 0,d.devServer=void 0,d.i=o,d.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(d,"root",{get:function(){return s[a]}}),s[a]=d;for(var u=0;u<t.length;u++)d(t[u]);if(r){var h=d(r);"object"==typeof exports&&"u">typeof module?module.exports=h:"function"==typeof define&&define.amd&&define(function(){return h})}}({"1qMFK":[function(e,t,r,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"default",()=>o);var s=e("./VideoShim.js"),n=i.interopDefault(s);function o(e={}){return t=>{let{constructor:r}=t,{createElement:a}=r.utils,i=a("canvas"),s=i.getContext("2d"),o=new(0,n.default)({art:t,canvas:i,ctx:s,option:e}),l={};for(let e in i)"function"==typeof i[e]&&(l[e]=i[e].bind(i));for(let e of new Set([...Object.getOwnPropertyNames(o),...Object.getOwnPropertyNames(Object.getPrototypeOf(o))]))"constructor"!==e&&(e in i||Object.defineProperty(i,e,{get(){let t=o[e];return"function"==typeof t?t.bind(o):t},set(t){o[e]=t},configurable:!0,enumerable:!0}));for(let e in l)i[e]=(...t)=>l[e](...t);function c(){t.template?.$player&&!t.option.autoSize&&Object.assign(i.style,{width:"100%",height:"100%",objectFit:"contain"})}return t.on("resize",c),t.on("video:loadedmetadata",c),t.on("destroy",()=>{o.destroy()}),i}}"u">typeof window&&(window.artplayerProxyMediabunny=o)},{"./VideoShim.js":"asNFi","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],asNFi:[function(e,t,r,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r);var s=e("./EventTarget.js"),n=i.interopDefault(s),o=e("./MediaBunnyEngine.js"),l=i.interopDefault(o);r.default=class{constructor({art:e,canvas:t,ctx:r,option:a}){this.art=e,this.canvas=t,this.option=a,this.events=new(0,n.default),this.engine=new(0,l.default)({canvas:t,ctx:r,events:this.events,option:a}),this._src=null,this._volume=a.volume??.7,this._muted=!!a.muted,this._playbackRate=1,this.engine.setVolume(this._volume,this._muted),this.setupEventForwarding(),a.source?this.src=a.source:e.option?.url&&(this.src=e.option.url)}setupEventForwarding(){let{events:e}=this.art.constructor.config;e.forEach(e=>{this.events.addEventListener(e,e=>{this.art.emit(`video:${e.type}`,e)})})}addEventListener(e,t){this.events.addEventListener(e,t)}removeEventListener(e,t){this.events.removeEventListener(e,t)}get src(){return this._src}set src(e){this._src=e,e&&this.engine.load(e)}get currentSrc(){return this._src}get currentTime(){return this.engine.currentTime}set currentTime(e){this.engine.seek(Number(e)||0)}get duration(){return this.engine.duration}get buffered(){return this.createTimeRanges(0,this.engine.duration)}get played(){return this.createTimeRanges(0,this.engine.currentTime)}get seekable(){return this.createTimeRanges(0,this.engine.duration)}createTimeRanges(e,t){let r=this.engine.duration;return!r||Number.isNaN(r)||t<=0?{length:0,start:()=>0,end:()=>0}:{length:1,start:()=>e,end:()=>t}}get paused(){return this.engine.paused}get playing(){return!this.engine.paused&&!this.engine.ended}get ended(){return this.engine.ended}get seeking(){return this.engine.seeking}get readyState(){return this.engine.readyState}get networkState(){return this.engine.networkState}get error(){return this.engine.error}get playbackRate(){return this._playbackRate}set playbackRate(e){let t=Number(e);Number.isNaN(t)||t<=0||(this._playbackRate=t,this.engine.setPlaybackRate(t),this.events.emit("ratechange"))}get volume(){return this._volume}set volume(e){this._volume=Math.max(0,Math.min(1,Number(e)||0)),this._muted=!1,this.engine.setVolume(this._volume,this._muted),this.events.emit("voLine truncated
|
||||
!function(e,t){"object"===typeof exports&&"undefined"!==typeof module?module.exports=t():"function"==typeof define&&define.amd?(t.ArtplayerProxyMediabunny=t(),define(function(){return t.ArtplayerProxyMediabunny})):(e="undefined"!==typeof globalThis?globalThis:e||self).ArtplayerProxyMediabunny=t()}(this,function(){"use strict";class e{constructor(){this.listeners=new Map}addEventListener(e,t){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t)}removeEventListener(e,t){const r=this.listeners.get(e);if(!r)return;const i=r.indexOf(t);i>=0&&r.splice(i,1)}emit(e,t){const r=new Event(e);r.detail=t;const i=this.listeners.get(e);i&&i.forEach(e=>e(r))}}function t(e){if(!e)throw new Error("Assertion failed.")}const r=e=>{const t=(e%360+360)%360;if(0===t||90===t||180===t||270===t)return t;throw new Error(`Invalid rotation ${e}.`)},i=e=>e&&e[e.length-1];class a{constructor(e){this.bytes=e,this.pos=0}seekToByte(e){this.pos=8*e}readBit(){const e=Math.floor(this.pos/8),t=this.bytes[e]??0,r=7-(7&this.pos),i=(t&1<<r)>>r;return this.pos++,i}readBits(e){if(1===e)return this.readBit();let t=0;for(let r=0;r<e;r++)t<<=1,t|=this.readBit();return t}writeBits(e,t){const r=this.pos+e;for(let i=this.pos;i<r;i++){const e=Math.floor(i/8);let a=this.bytes[e];const s=7-(7&i);a&=~(1<<s),a|=(t&1<<r-i-1)>>r-i-1<<s,this.bytes[e]=a}this.pos=r}readAlignedByte(){if(this.pos%8!==0)throw new Error("Bitstream is not byte-aligned.");const e=this.pos/8,t=this.bytes[e]??0;return this.pos+=8,t}skipBits(e){this.pos+=e}getBitsLeft(){return 8*this.bytes.length-this.pos}clone(){const e=new a(this.bytes);return e.pos=this.pos,e}}const s=e=>{let t=0;for(;0===e.readBits(1)&&t<32;)t++;if(t>=32)throw new Error("Invalid exponential-Golomb code.");return(1<<t)-1+e.readBits(t)},n=e=>{const t=s(e);return 0===(1&t)?-(t>>1):t+1>>1},o=e=>e.constructor===Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e),c=e=>e.constructor===DataView?e:ArrayBuffer.isView(e)?new DataView(e.buffer,e.byteOffset,e.byteLength):new DataView(e),l=new TextDecoder,d=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[t,e])),u={bt709:1,bt470bg:5,smpte170m:6,bt2020:9,smpte432:12},h=d(u),m={bt709:1,smpte170m:6,linear:8,"iec61966-2-1":13,pq:16,hlg:18},f=d(m),p={rgb:0,bt709:1,bt470bg:5,smpte170m:6,"bt2020-ncl":9},g=d(p),k=e=>e instanceof ArrayBuffer||"undefined"!==typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer||ArrayBuffer.isView(e);class b{constructor(){this.currentPromise=Promise.resolve()}async acquire(){let e;const t=new Promise(t=>{e=t}),r=this.currentPromise;return this.currentPromise=t,await r,e}}const T=e=>[...e].map(e=>e.toString(16).padStart(2,"0")).join(""),y=e=>(e=(e=(e=(e=(e=e>>1&1431655765|(1431655765&e)<<1)>>2&858993459|(858993459&e)<<2)>>4&252645135|(252645135&e)<<4)>>8&16711935|(16711935&e)<<8)>>16&65535|(65535&e)<<16)>>>0,w=(e,t,r)=>{let i=0,a=e.length-1,s=-1;for(;i<=a;){const n=i+a>>1,o=r(e[n]);o===t?(s=n,a=n-1):o<t?i=n+1:a=n-1}return s},S=(e,t,r)=>{let i=0,a=e.length-1,s=-1;for(;i<=a;){const n=i+(a-i+1)/2|0;r(e[n])<=t?(s=n,i=n+1):a=n-1}return s},I=(e,t,r)=>{const i=S(e,r(t),r);e.splice(i+1,0,t)},v=()=>{let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}},P=(e,t)=>{for(let r=e.length-1;r>=0;r--)if(t(e[r]))return e[r]},x=(e,t)=>{for(let r=e.length-1;r>=0;r--)if(t(e[r]))return r;return-1},C=e=>{throw new Error(`Unexpected value: ${e}`)},_=(e,t,r)=>{const i=e.getUint8(t),a=e.getUint8(t+1),s=e.getUint8(t+2);return r?i|a<<8|s<<16:i<<16|a<<8|s},B=(e,t,r,i)=>{r>>>=0,r&=16777215,e.setUint8(t,r>>>16&255),e.setUint8(t+1,r>>>8&255),e.setUint8(t+2,255&r)},E=(e,t)=>({async next(){const r=await e.next();return r.done?{value:void 0,done:!0}:{value:t(r.value),done:!1}},return:()=>e.return(),throw:t=>e.throw(t),[Symbol.asyncIterator](){return this}}),F=(e,t,r)=>Math.max(t,Math.min(r,e)),D="und",A=e=>{const t=Math.round(e);return Math.abs(e/t-1)<10*Number.EPSILON?t:e},R=/^[a-z]{3}$/,M=e=>R.test(e),N=1e6*(1+Number.EPSILON),z=(e,t)=>{const r={...e,...t};if(e.headers||t.headers){const i=e.headers?O(e.headers):{},a=t.headers?O(t.headers):{},s={...i};Object.entries(a).forEach(([e,t])=>{const r=Object.keys(s).find(t=>t.toLowerCase()===e.toLowerCase());r&&delete s[r],s[e]=t}),r.headers=s}return r},O=e=>{if(e instanceof Headers){const t={};return e.forEach((e,r)=>{t[r]=e}),t}if(Array.isArray(e)){const t={};return e.forEach(([e,r])=>{t[e]=r}),t}return e},L=async(e,t,r,i,a)=>{let s=0;for(;;)try{return await e(t,r)}catch(n){if(a())throw n;s++;const e=i(s,n,t);if(null===e)throw n;if(console.error("Retrying failed fetch. Error:",n),!Number.isFinite(e)||e<0)throw new TypeError("Retry delay must be a non-negative finite number.");if(e>0&&await new Promise(t=>setTimeout(t,1e3*e)),a())throw n}};class U{constructor(){this.currentPromise=Promise.resolve()}call(e){return this.currentPromise=this.currentPromise.then(e)}}let V=null;const q=()=>null!==V?V:V=!("undefined"===typeof navigator||!(navigator.vendor?Line truncated
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-proxy-mediabunny.js v1.0.0
|
||||
* artplayer-proxy-mediabunny.js v1.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,n,a){var i="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},s="function"==typeof i[n]&&i[n],o=s.i||{},c=s.cache||{},u="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function l(t,r){if(!c[t]){if(!e[t]){if(a[t])return a[t];var o="function"==typeof i[n]&&i[n];if(!r&&o)return o(t,!0);if(s)return s(t,!0);if(u&&"string"==typeof t)return u(t);var d=Error("Cannot find module '"+t+"'");throw d.code="MODULE_NOT_FOUND",d}h.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},h.cache={};var f=c[t]=new l.Module(t);e[t][0].call(f.exports,h,f,f.exports,i)}return c[t].exports;function h(e){var t=h.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],i=l(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]}})}):"*"===a?Object.defineProperty(r,t,{enumerable:!0,value:i}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===a?i.__esModule?i.default:i:i[a]}})}),r}return l(t)}}l.isParcelRequire=!0,l.Module=function(e){this.id=e,this.bundle=l,this.require=u,this.exports={}},l.modules=e,l.cache=c,l.parent=s,l.distDir=void 0,l.publicUrl=void 0,l.devServer=void 0,l.i=o,l.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(l,"root",{get:function(){return i[n]}}),i[n]=l;for(var d=0;d<t.length;d++)l(t[d]);if(r){var f=l(r);"object"==typeof exports&&"u">typeof module?module.exports=f:"function"==typeof define&&define.amd&&define(function(){return f})}}({OIaIB:[function(e,t,r,n){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(r),a.export(r,"default",function(){return c});var i=e("@swc/helpers/cjs/_to_consumable_array.cjs"),s=e("./VideoShim.js"),o=a.interopDefault(s);function c(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t){var r=function(e){n[e]=function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return c[e].apply(c,(0,i._)(r))}},n=(0,t.constructor.utils.createElement)("canvas"),a=n.getContext("2d"),s=new(0,o.default)({art:t,canvas:n,ctx:a,option:e}),c={};for(var u in n)"function"==typeof n[u]&&(c[u]=n[u].bind(n));var l=new Set((0,i._)(Object.getOwnPropertyNames(s)).concat((0,i._)(Object.getOwnPropertyNames(Object.getPrototypeOf(s))))),d=!0,f=!1,h=void 0;try{for(var p,m=l[Symbol.iterator]();!(d=(p=m.next()).done);d=!0)!function(){var e=p.value;"constructor"===e||e in n||Object.defineProperty(n,e,{get:function(){var t=s[e];return"function"==typeof t?t.bind(s):t},set:function(t){s[e]=t},configurable:!0,enumerable:!0})}()}catch(e){f=!0,h=e}finally{try{d||null==m.return||m.return()}finally{if(f)throw h}}for(var g in c)r(g);function v(){var e;(null==(e=t.template)?void 0:e.$player)&&!t.option.autoSize&&Object.assign(n.style,{width:"100%",height:"100%",objectFit:"contain"})}return t.on("resize",v),t.on("video:loadedmetadata",v),t.on("destroy",function(){s.destroy()}),n}}"u">typeof window&&(window.artplayerProxyMediabunny=c)},{"@swc/helpers/cjs/_to_consumable_array.cjs":"i81N6","./VideoShim.js":"45n2R","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],i81N6:[function(e,t,r,n){"use strict";var a=e("d402183024004bc7"),i=e("3209e2b12672cd18"),s=e("fc58adb8f1bff142"),o=e("5e213dc122a10171");r._=function(e){return a._(e)||i._(e)||o._(e)||s._()}},{d402183024004bc7:"hfQG0","3209e2b12672cd18":"fQrlQ",fc58adb8f1bff142:"fWabh","5e213dc122a10171":"fh7mx"}],hfQG0:[function(e,t,r,n){"use strict";var a=e("5bd5b10bf87fc8e");r._=function(e){if(Array.isArray(e))return a._(e)}},{"5bd5b10bf87fc8e":"1WOAB"}],"1WOAB":[function(e,t,r,n){"use strict";r._=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}},{}],fQrlQ:[function(e,t,r,n){"use strict";r._=function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}},{}],fWabh:[function(e,t,r,n){"use strict";r._=function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},{}],fh7mx:[function(e,t,r,n){"use strict";var a=e("3ee51b7dc02d0c44");r._=function(e,t){if(e){if("string"==typeof e)return a._(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return a._(e,t)}}},{"3ee51b7dc02d0c44":"1WOAB"}],"45n2R":[function(e,t,r,n){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(r),a.export(r,"default",function(){return d});var i=e("@swc/helpers/cjs/_class_call_check.cjs"),s=e("@swc/helpers/cjs/_create_class.cjs"),o=e("./EventTarget.js"),c=a.interopDefault(o),u=e(Line truncated
|
||||
!function(e,t){"object"===typeof exports&&"undefined"!==typeof module?module.exports=t():"function"==typeof define&&define.amd?(t.ArtplayerProxyMediabunny=t(),define(function(){return t.ArtplayerProxyMediabunny})):(e="undefined"!==typeof globalThis?globalThis:e||self).ArtplayerProxyMediabunny=t()}(this,function(){"use strict";var e=Object.defineProperty,t=Object.defineProperties,r=Object.getOwnPropertyDescriptors,i=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,a=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),o=Math.pow,l=(t,r,i)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[r]=i,c=(e,t)=>{for(var r in t||(t={}))n.call(t,r)&&l(e,r,t[r]);if(i)for(var r of i(t))s.call(t,r)&&l(e,r,t[r]);return e},u=(e,t,r)=>new Promise((i,n)=>{var s=e=>{try{o(r.next(e))}catch(t){n(t)}},a=e=>{try{o(r.throw(e))}catch(t){n(t)}},o=e=>e.done?i(e.value):Promise.resolve(e.value).then(s,a);o((r=r.apply(e,t)).next())}),d=function(e,t){this[0]=e,this[1]=t},h=e=>{var t,r=e[a("asyncIterator")],i=!1,n={};return null==r?(r=e[a("iterator")](),t=e=>n[e]=t=>r[e](t)):(r=r.call(e),t=e=>n[e]=t=>{if(i){if(i=!1,"throw"===e)throw t;return t}return i=!0,{done:!1,value:new d(new Promise(i=>{var n=r[e](t);n instanceof Object||(e=>{throw TypeError(e)})("Object expected"),i(n)}),1)}}),n[a("iterator")]=()=>n,t("next"),"throw"in r?t("throw"):n.throw=e=>{throw e},"return"in r&&t("return"),n},m=(e,t,r)=>(t=e[a("asyncIterator")])?t.call(e):(e=e[a("iterator")](),t={},(r=(r,i)=>(i=e[r])&&(t[r]=t=>new Promise((r,n,s)=>(t=i.call(e,t),s=t.done,Promise.resolve(t.value).then(e=>r({value:e,done:s}),n)))))("next"),r("return"),t);class f{constructor(){this.listeners=new Map}addEventListener(e,t){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t)}removeEventListener(e,t){const r=this.listeners.get(e);if(!r)return;const i=r.indexOf(t);i>=0&&r.splice(i,1)}emit(e,t){const r=new Event(e);r.detail=t;const i=this.listeners.get(e);i&&i.forEach(e=>e(r))}}function p(e){if(!e)throw new Error("Assertion failed.")}const g=e=>{const t=(e%360+360)%360;if(0===t||90===t||180===t||270===t)return t;throw new Error(`Invalid rotation ${e}.`)},k=e=>e&&e[e.length-1];class b{constructor(e){this.bytes=e,this.pos=0}seekToByte(e){this.pos=8*e}readBit(){var e;const t=Math.floor(this.pos/8),r=null!=(e=this.bytes[t])?e:0,i=7-(7&this.pos),n=(r&1<<i)>>i;return this.pos++,n}readBits(e){if(1===e)return this.readBit();let t=0;for(let r=0;r<e;r++)t<<=1,t|=this.readBit();return t}writeBits(e,t){const r=this.pos+e;for(let i=this.pos;i<r;i++){const e=Math.floor(i/8);let n=this.bytes[e];const s=7-(7&i);n&=~(1<<s),n|=(t&1<<r-i-1)>>r-i-1<<s,this.bytes[e]=n}this.pos=r}readAlignedByte(){var e;if(this.pos%8!==0)throw new Error("Bitstream is not byte-aligned.");const t=this.pos/8,r=null!=(e=this.bytes[t])?e:0;return this.pos+=8,r}skipBits(e){this.pos+=e}getBitsLeft(){return 8*this.bytes.length-this.pos}clone(){const e=new b(this.bytes);return e.pos=this.pos,e}}const y=e=>{let t=0;for(;0===e.readBits(1)&&t<32;)t++;if(t>=32)throw new Error("Invalid exponential-Golomb code.");return(1<<t)-1+e.readBits(t)},T=e=>{const t=y(e);return 0===(1&t)?-(t>>1):t+1>>1},S=e=>e.constructor===Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e),v=e=>e.constructor===DataView?e:ArrayBuffer.isView(e)?new DataView(e.buffer,e.byteOffset,e.byteLength):new DataView(e),w=new TextDecoder,I=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[t,e])),P={bt709:1,bt470bg:5,smpte170m:6,bt2020:9,smpte432:12},x=I(P),C={bt709:1,smpte170m:6,linear:8,"iec61966-2-1":13,pq:16,hlg:18},_=I(C),B={rgb:0,bt709:1,bt470bg:5,smpte170m:6,"bt2020-ncl":9},E=I(B),F=e=>e instanceof ArrayBuffer||"undefined"!==typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer||ArrayBuffer.isView(e);class D{constructor(){this.currentPromise=Promise.resolve()}acquire(){return u(this,null,function*(){let e;const t=new Promise(t=>{e=t}),r=this.currentPromise;return this.currentPromise=t,yield r,e})}}const A=e=>[...e].map(e=>e.toString(16).padStart(2,"0")).join(""),R=e=>(e=(e=(e=(e=(e=e>>1&1431655765|(1431655765&e)<<1)>>2&858993459|(858993459&e)<<2)>>4&252645135|(252645135&e)<<4)>>8&16711935|(16711935&e)<<8)>>16&65535|(65535&e)<<16)>>>0,M=(e,t,r)=>{let i=0,n=e.length-1,s=-1;for(;i<=n;){const a=i+n>>1,o=r(e[a]);o===t?(s=a,n=a-1):o<t?i=a+1:n=a-1}return s},N=(e,t,r)=>{let i=0,n=e.length-1,s=-1;for(;i<=n;){const a=i+(n-i+1)/2|0;r(e[a])<=t?(s=a,i=a+1):n=a-1}return s},z=(e,t,r)=>{const i=N(e,r(t),r);e.splice(i+1,0,t)},O=()=>{let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}},L=(e,t)=>{for(let r=e.length-1;r>=0;r--)if(t(e[r]))return e[r]},U=(e,t)=>{for(let r=e.length-1;r>=0;r--)if(t(e[r]))return r;return-1},V=function(e){return((e,t,r)=>{var i=(e,t,n,s)=>{try{var a=r[e](t),o=(t=a.value)instanceof d,l=a.done;Promise.resolve(o?t[0]:t).then(r=>o?i("return"===e?e:"next",t[1]?{done:r.done,value:r.value}:r,n,s):n({vaLine truncated
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-proxy-mediabunny.js v1.0.0
|
||||
* artplayer-proxy-mediabunny.js v1.0.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,a,i){var s="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},n="function"==typeof s[a]&&s[a],o=n.i||{},l=n.cache||{},c="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,r){if(!l[t]){if(!e[t]){if(i[t])return i[t];var o="function"==typeof s[a]&&s[a];if(!r&&o)return o(t,!0);if(n)return n(t,!0);if(c&&"string"==typeof t)return c(t);var u=Error("Cannot find module '"+t+"'");throw u.code="MODULE_NOT_FOUND",u}m.resolve=function(r){var a=e[t][1][r];return null!=a?a:r},m.cache={};var h=l[t]=new d.Module(t);e[t][0].call(h.exports,m,h,h.exports,s)}return l[t].exports;function m(e){var t=m.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],i=e[2]||e[0],s=d(a);"*"===t?Object.keys(s).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return s[e]}})}):"*"===i?Object.defineProperty(r,t,{enumerable:!0,value:s}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===i?s.__esModule?s.default:s:s[i]}})}),r}return d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.require=c,this.exports={}},d.modules=e,d.cache=l,d.parent=n,d.distDir=void 0,d.publicUrl=void 0,d.devServer=void 0,d.i=o,d.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(d,"root",{get:function(){return s[a]}}),s[a]=d;for(var u=0;u<t.length;u++)d(t[u]);if(r){var h=d(r);"object"==typeof exports&&"u">typeof module?module.exports=h:"function"==typeof define&&define.amd&&define(function(){return h})}}({"2x2Ir":[function(e,t,r,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r),i.export(r,"default",()=>o);var s=e("./VideoShim.js"),n=i.interopDefault(s);function o(e={}){return t=>{let{constructor:r}=t,{createElement:a}=r.utils,i=a("canvas"),s=i.getContext("2d"),o=new(0,n.default)({art:t,canvas:i,ctx:s,option:e}),l={};for(let e in i)"function"==typeof i[e]&&(l[e]=i[e].bind(i));for(let e of new Set([...Object.getOwnPropertyNames(o),...Object.getOwnPropertyNames(Object.getPrototypeOf(o))]))"constructor"!==e&&(e in i||Object.defineProperty(i,e,{get(){let t=o[e];return"function"==typeof t?t.bind(o):t},set(t){o[e]=t},configurable:!0,enumerable:!0}));for(let e in l)i[e]=(...t)=>l[e](...t);function c(){t.template?.$player&&!t.option.autoSize&&Object.assign(i.style,{width:"100%",height:"100%",objectFit:"contain"})}return t.on("resize",c),t.on("video:loadedmetadata",c),t.on("destroy",()=>{o.destroy()}),i}}"u">typeof window&&(window.artplayerProxyMediabunny=o)},{"./VideoShim.js":"kzYuW","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],kzYuW:[function(e,t,r,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(r);var s=e("./EventTarget.js"),n=i.interopDefault(s),o=e("./MediaBunnyEngine.js"),l=i.interopDefault(o);r.default=class{constructor({art:e,canvas:t,ctx:r,option:a}){this.art=e,this.canvas=t,this.option=a,this.events=new(0,n.default),this.engine=new(0,l.default)({canvas:t,ctx:r,events:this.events,option:a}),this._src=null,this._volume=a.volume??.7,this._muted=!!a.muted,this._playbackRate=1,this.engine.setVolume(this._volume,this._muted),this.setupEventForwarding(),a.source?this.src=a.source:e.option?.url&&(this.src=e.option.url)}setupEventForwarding(){let{events:e}=this.art.constructor.config;e.forEach(e=>{this.events.addEventListener(e,e=>{this.art.emit(`video:${e.type}`,e)})})}addEventListener(e,t){this.events.addEventListener(e,t)}removeEventListener(e,t){this.events.removeEventListener(e,t)}get src(){return this._src}set src(e){this._src=e,e&&this.engine.load(e)}get currentSrc(){return this._src}get currentTime(){return this.engine.currentTime}set currentTime(e){this.engine.seek(Number(e)||0)}get duration(){return this.engine.duration}get buffered(){return this.createTimeRanges(0,this.engine.duration)}get played(){return this.createTimeRanges(0,this.engine.currentTime)}get seekable(){return this.createTimeRanges(0,this.engine.duration)}createTimeRanges(e,t){let r=this.engine.duration;return!r||Number.isNaN(r)||t<=0?{length:0,start:()=>0,end:()=>0}:{length:1,start:()=>e,end:()=>t}}get paused(){return this.engine.paused}get playing(){return!this.engine.paused&&!this.engine.ended}get ended(){return this.engine.ended}get seeking(){return this.engine.seeking}get readyState(){return this.engine.readyState}get networkState(){return this.engine.networkState}get error(){return this.engine.error}get playbackRate(){return this._playbackRate}set playbackRate(e){let t=Number(e);Number.isNaN(t)||t<=0||(this._playbackRate=t,this.engine.setPlaybackRate(t),this.events.emit("ratechange"))}get volume(){return this._volume}set volume(e){this._volume=Math.max(0,Math.min(1,Number(e)||0)),this._muted=!1,this.engine.setVolume(this._volume,this._muted),this.events.emit("voLine truncated
|
||||
class e{constructor(){this.listeners=/* @__PURE__ */new Map}addEventListener(e,t){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t)}removeEventListener(e,t){const r=this.listeners.get(e);if(!r)return;const a=r.indexOf(t);a>=0&&r.splice(a,1)}emit(e,t){const r=new Event(e);r.detail=t;const a=this.listeners.get(e);a&&a.forEach(e=>e(r))}}function t(e){if(!e)throw new Error("Assertion failed.")}const r=e=>{const t=(e%360+360)%360;if(0===t||90===t||180===t||270===t)return t;throw new Error(`Invalid rotation ${e}.`)},a=e=>e&&e[e.length-1];class i{constructor(e){this.bytes=e,this.pos=0}seekToByte(e){this.pos=8*e}readBit(){const e=Math.floor(this.pos/8),t=this.bytes[e]??0,r=7-(7&this.pos),a=(t&1<<r)>>r;return this.pos++,a}readBits(e){if(1===e)return this.readBit();let t=0;for(let r=0;r<e;r++)t<<=1,t|=this.readBit();return t}writeBits(e,t){const r=this.pos+e;for(let a=this.pos;a<r;a++){const e=Math.floor(a/8);let i=this.bytes[e];const s=7-(7&a);i&=~(1<<s),i|=(t&1<<r-a-1)>>r-a-1<<s,this.bytes[e]=i}this.pos=r}readAlignedByte(){if(this.pos%8!==0)throw new Error("Bitstream is not byte-aligned.");const e=this.pos/8,t=this.bytes[e]??0;return this.pos+=8,t}skipBits(e){this.pos+=e}getBitsLeft(){return 8*this.bytes.length-this.pos}clone(){const e=new i(this.bytes);return e.pos=this.pos,e}}const s=e=>{let t=0;for(;0===e.readBits(1)&&t<32;)t++;if(t>=32)throw new Error("Invalid exponential-Golomb code.");return(1<<t)-1+e.readBits(t)},n=e=>{const t=s(e);return 0===(1&t)?-(t>>1):t+1>>1},o=e=>e.constructor===Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e),c=e=>e.constructor===DataView?e:ArrayBuffer.isView(e)?new DataView(e.buffer,e.byteOffset,e.byteLength):new DataView(e),l=/* @__PURE__ */new TextDecoder,d=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[t,e])),u={bt709:1,bt470bg:5,smpte170m:6,bt2020:9,smpte432:12},h=/* @__PURE__ */d(u),m={bt709:1,smpte170m:6,linear:8,"iec61966-2-1":13,pq:16,hlg:18},f=/* @__PURE__ */d(m),p={rgb:0,bt709:1,bt470bg:5,smpte170m:6,"bt2020-ncl":9},g=/* @__PURE__ */d(p),k=e=>e instanceof ArrayBuffer||"undefined"!==typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer||ArrayBuffer.isView(e);class b{constructor(){this.currentPromise=Promise.resolve()}async acquire(){let e;const t=new Promise(t=>{e=t}),r=this.currentPromise;return this.currentPromise=t,await r,e}}const T=e=>[...e].map(e=>e.toString(16).padStart(2,"0")).join(""),y=e=>(e=(e=(e=(e=(e=e>>1&1431655765|(1431655765&e)<<1)>>2&858993459|(858993459&e)<<2)>>4&252645135|(252645135&e)<<4)>>8&16711935|(16711935&e)<<8)>>16&65535|(65535&e)<<16)>>>0,w=(e,t,r)=>{let a=0,i=e.length-1,s=-1;for(;a<=i;){const n=a+i>>1,o=r(e[n]);o===t?(s=n,i=n-1):o<t?a=n+1:i=n-1}return s},S=(e,t,r)=>{let a=0,i=e.length-1,s=-1;for(;a<=i;){const n=a+(i-a+1)/2|0;r(e[n])<=t?(s=n,a=n+1):i=n-1}return s},I=(e,t,r)=>{const a=S(e,r(t),r);e.splice(a+1,0,t)},v=()=>{let e,t;return{promise:new Promise((r,a)=>{e=r,t=a}),resolve:e,reject:t}},P=(e,t)=>{for(let r=e.length-1;r>=0;r--)if(t(e[r]))return e[r]},x=(e,t)=>{for(let r=e.length-1;r>=0;r--)if(t(e[r]))return r;return-1},C=e=>{throw new Error(`Unexpected value: ${e}`)},_=(e,t,r)=>{const a=e.getUint8(t),i=e.getUint8(t+1),s=e.getUint8(t+2);return r?a|i<<8|s<<16:a<<16|i<<8|s},B=(e,t,r,a)=>{r>>>=0,r&=16777215,e.setUint8(t,r>>>16&255),e.setUint8(t+1,r>>>8&255),e.setUint8(t+2,255&r)},E=(e,t)=>({async next(){const r=await e.next();return r.done?{value:void 0,done:!0}:{value:t(r.value),done:!1}},return:()=>e.return(),throw:t=>e.throw(t),[Symbol.asyncIterator](){return this}}),F=(e,t,r)=>Math.max(t,Math.min(r,e)),D="und",A=e=>{const t=Math.round(e);return Math.abs(e/t-1)<10*Number.EPSILON?t:e},R=/^[a-z]{3}$/,M=e=>R.test(e),N=1e6*(1+Number.EPSILON),z=(e,t)=>{const r={...e,...t};if(e.headers||t.headers){const a=e.headers?O(e.headers):{},i=t.headers?O(t.headers):{},s={...a};Object.entries(i).forEach(([e,t])=>{const r=Object.keys(s).find(t=>t.toLowerCase()===e.toLowerCase());r&&delete s[r],s[e]=t}),r.headers=s}return r},O=e=>{if(e instanceof Headers){const t={};return e.forEach((e,r)=>{t[r]=e}),t}if(Array.isArray(e)){const t={};return e.forEach(([e,r])=>{t[e]=r}),t}return e},L=async(e,t,r,a,i)=>{let s=0;for(;;)try{return await e(t,r)}catch(n){if(i())throw n;s++;const e=a(s,n,t);if(null===e)throw n;if(console.error("Retrying failed fetch. Error:",n),!Number.isFinite(e)||e<0)throw new TypeError("Retry delay must be a non-negative finite number.");if(e>0&&await new Promise(t=>setTimeout(t,1e3*e)),i())throw n}};class U{constructor(){this.currentPromise=Promise.resolve()}call(e){return this.currentPromise=this.currentPromise.then(e)}}let V=null;const q=()=>null!==V?V:V=!("undefined"===typeof navigator||!(navigator.vendor?.match(/apple/i)||/AppleWebKit/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)));let H=null;const W=()=>null!==H?H:H="undefined"!==typeof navigator&&navigator.userAgent?.includes("FirefLine truncated
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "artplayer-proxy-mediabunny",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "mediabunny proxy for ArtPlayer",
|
||||
"author": "Harvey Zhao <laozhaochaguan@gmail.com>",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-tool-thumbnail.js v4.3.12
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,i,r,o){var n="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},s="function"==typeof n[r]&&n[r],l=s.i||{},a=s.cache||{},h="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(t,i){if(!a[t]){if(!e[t]){if(o[t])return o[t];var l="function"==typeof n[r]&&n[r];if(!i&&l)return l(t,!0);if(s)return s(t,!0);if(h&&"string"==typeof t)return h(t);var d=Error("Cannot find module '"+t+"'");throw d.code="MODULE_NOT_FOUND",d}c.resolve=function(i){var r=e[t][1][i];return null!=r?r:i},c.cache={};var p=a[t]=new u.Module(t);e[t][0].call(p.exports,c,p,p.exports,n)}return a[t].exports;function c(e){var t=c.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var i={__esModule:!0};return t.forEach(function(e){var t=e[0],r=e[1],o=e[2]||e[0],n=u(r);"*"===t?Object.keys(n).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(i,e)||Object.defineProperty(i,e,{enumerable:!0,get:function(){return n[e]}})}):"*"===o?Object.defineProperty(i,t,{enumerable:!0,value:n}):Object.defineProperty(i,t,{enumerable:!0,get:function(){return"default"===o?n.__esModule?n.default:n:n[o]}})}),i}return u(t)}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.require=h,this.exports={}},u.modules=e,u.cache=a,u.parent=s,u.distDir=void 0,u.publicUrl=void 0,u.devServer=void 0,u.i=l,u.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(u,"root",{get:function(){return n[r]}}),n[r]=u;for(var d=0;d<t.length;d++)u(t[d]);if(i){var p=u(i);"object"==typeof exports&&"u">typeof module?module.exports=p:"function"==typeof define&&define.amd&&define(function(){return p})}}({c0Aef:[function(e,t,i,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(i);var n=e("./emitter"),s=o.interopDefault(n),l=e("./utils");class a extends s.default{constructor(e={}){super(),this.processing=!1,this.option={},this.setup(Object.assign({},a.DEFAULTS,e)),this.video=a.creatVideo(),this.duration=0,this.inputChange=this.inputChange.bind(this),this.ondrop=this.ondrop.bind(this),this.option.fileInput.addEventListener("change",this.inputChange),this.option.fileInput.addEventListener("dragover",a.ondragover),this.option.fileInput.addEventListener("drop",a.ondrop)}static get DEFAULTS(){return{number:60,width:160,height:90,column:10,begin:0,end:NaN}}static ondragover(e){e.preventDefault()}ondrop(e){e.preventDefault();let t=e.dataTransfer.files[0];this.loadVideo(t)}setup(e={}){this.option=Object.assign({},this.option,e);let{fileInput:t,number:i,width:r,column:o}=this.option;if(this.errorHandle(t instanceof Element,"The 'fileInput' is not a Element"),"INPUT"!==t.tagName||"file"!==t.type){t.style.position="relative";let e=document.createElement("input");e.type="file",e.style.position="absolute",e.style.width="100%",e.style.height="100%",e.style.left="0",e.style.top="0",e.style.right="0",e.style.bottom="0",e.style.opacity="0",t.appendChild(e),this.option.fileInput=e}return["number","width","column","begin","end"].forEach(e=>{this.errorHandle("number"==typeof this.option[e],`The '${e}' is not a number`)}),this.option.number=(0,l.clamp)(i,10,1e3),this.option.width=(0,l.clamp)(r,10,1e3),this.option.column=(0,l.clamp)(o,1,1e3),this}static creatVideo(){let e=document.createElement("video");return e.style.position="absolute",e.style.top="-9999px",e.style.left="-9999px",e.muted=!0,e.controls=!0,document.body.appendChild(e),e}inputChange(e){let t=this.option.fileInput.files[0];this.loadVideo(t),e.target.value=""}loadVideo(e){if(e){let t=this.video.canPlayType(e.type);this.errorHandle("maybe"===t||"probably"===t,`Playback of this file format is not supported: ${e.type}`);let i=URL.createObjectURL(e);this.videoUrl=i,this.file=e,this.emit("file",this.file),this.video.src=i,this.emit("video",this.video)}}start(){if(!this.video.duration)return(0,l.sleep)(1e3).then(()=>this.start());let{width:e,number:t,begin:i,end:r}=this.option,o=this.video.videoHeight/this.video.videoWidth*e;this.option.height=o,this.option.begin=(0,l.clamp)(i,0,this.video.duration),this.option.end=(0,l.clamp)(r||this.video.duration,i,this.video.duration),this.errorHandle(this.option.end>this.option.begin,"End time must be greater than the start time"),this.duration=this.option.end-this.option.begin,this.density=t/this.duration,this.errorHandle(this.file&&this.video,"Please select the video file first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment..."),this.errorHandle(this.density<=1,`The preview density cannot be greater than 1, but got ${this.density}`);let n=this.creatScreenshotDate(),s=this.creatCanvas(),a=s.getContext("2d");this.emit("canvas",s);let h=n.map((i,r)=>()=>new Promise(n=>{this.video.oncanplay=()=>{a.drawImage(this.video,i.x,i.y,e,o),s.toBlob(e=>{this.thumbnailUrl&&URL.revokeObjectURL(this.thumbnailUrl),this.thumbnailUrl=URL.createObjectURL(e),this.emit("update",thisLine truncated
|
||||
!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.ArtplayerToolThumbnail=e(),define(function(){return t.ArtplayerToolThumbnail})):(t="undefined"!==typeof globalThis?globalThis:t||self).ArtplayerToolThumbnail=e()}(this,function(){"use strict";class t{on(t,e,i){const n=this.e||(this.e={});return(n[t]||(n[t]=[])).push({fn:e,ctx:i}),this}once(t,e,i){const n=this;function o(...s){n.off(t,o),e.apply(i,s)}return o._=e,this.on(t,o,i)}emit(t,...e){const i=((this.e||(this.e={}))[t]||[]).slice();for(let n=0;n<i.length;n+=1)i[n].fn.apply(i[n].ctx,e);return this}off(t,e){const i=this.e||(this.e={}),n=i[t],o=[];if(n&&e)for(let s=0,r=n.length;s<r;s+=1)n[s].fn!==e&&n[s].fn._!==e&&o.push(n[s]);return o.length?i[t]=o:delete i[t],this}}function e(t,e,i){return Math.max(Math.min(t,Math.max(e,i)),Math.min(e,i))}class i extends t{constructor(t={}){super(),this.processing=!1,this.option={},this.setup(Object.assign({},i.DEFAULTS,t)),this.video=i.creatVideo(),this.duration=0,this.inputChange=this.inputChange.bind(this),this.ondrop=this.ondrop.bind(this),this.option.fileInput.addEventListener("change",this.inputChange),this.option.fileInput.addEventListener("dragover",i.ondragover),this.option.fileInput.addEventListener("drop",i.ondrop)}static get DEFAULTS(){return{number:60,width:160,height:90,column:10,begin:0,end:Number.NaN}}static ondragover(t){t.preventDefault()}ondrop(t){t.preventDefault();const e=t.dataTransfer.files[0];this.loadVideo(e)}setup(t={}){this.option=Object.assign({},this.option,t);const{fileInput:i,number:n,width:o,column:s}=this.option;if(this.errorHandle(i instanceof Element,"The 'fileInput' is not a Element"),"INPUT"!==i.tagName||"file"!==i.type){i.style.position="relative";const t=document.createElement("input");t.type="file",t.style.position="absolute",t.style.width="100%",t.style.height="100%",t.style.left="0",t.style.top="0",t.style.right="0",t.style.bottom="0",t.style.opacity="0",i.appendChild(t),this.option.fileInput=t}return["number","width","column","begin","end"].forEach(t=>{this.errorHandle("number"===typeof this.option[t],`The '${t}' is not a number`)}),this.option.number=e(n,10,1e3),this.option.width=e(o,10,1e3),this.option.column=e(s,1,1e3),this}static creatVideo(){const t=document.createElement("video");return t.style.position="absolute",t.style.top="-9999px",t.style.left="-9999px",t.muted=!0,t.controls=!0,document.body.appendChild(t),t}inputChange(t){const e=this.option.fileInput.files[0];this.loadVideo(e),t.target.value=""}loadVideo(t){if(t){const e=this.video.canPlayType(t.type);this.errorHandle("maybe"===e||"probably"===e,`Playback of this file format is not supported: ${t.type}`);const i=URL.createObjectURL(t);this.videoUrl=i,this.file=t,this.emit("file",this.file),this.video.src=i,this.emit("video",this.video)}}start(){if(!this.video.duration)return(t=1e3,new Promise(e=>setTimeout(e,t))).then(()=>this.start());var t;const{width:i,number:n,begin:o,end:s}=this.option,r=this.video.videoHeight/this.video.videoWidth*i;this.option.height=r,this.option.begin=e(o,0,this.video.duration),this.option.end=e(s||this.video.duration,o,this.video.duration),this.errorHandle(this.option.end>this.option.begin,"End time must be greater than the start time"),this.duration=this.option.end-this.option.begin,this.density=n/this.duration,this.errorHandle(this.file&&this.video,"Please select the video file first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment..."),this.errorHandle(this.density<=1,`The preview density cannot be greater than 1, but got ${this.density}`);const h=this.creatScreenshotDate(),a=this.creatCanvas(),l=a.getContext("2d");this.emit("canvas",a);const d=h.map((t,e)=>()=>new Promise(o=>{this.video.oncanplay=()=>{l.drawImage(this.video,t.x,t.y,i,r),a.toBlob(t=>{this.thumbnailUrl&&URL.revokeObjectURL(this.thumbnailUrl),this.thumbnailUrl=URL.createObjectURL(t),this.emit("update",this.thumbnailUrl,(e+1)/n),this.video.oncanplay=null,o()})},this.video.currentTime=t.time}));return this.processing=!0,(p=d,p.reduce((t,e)=>t.then(e),Promise.resolve())).then(()=>{this.processing=!1,this.emit("done")}).catch(t=>{throw this.processing=!1,this.emit("error",t.message),t});var p}creatScreenshotDate(){const{number:t,width:e,height:i,column:n,begin:o}=this.option,s=this.duration/t,r=[o+s];for(;r.length<t;){const t=r[r.length-1];r.push(t+s)}return r.map((t,o)=>({time:t-s/2,x:o%n*e,y:Math.floor(o/n)*i}))}creatCanvas(){const{number:t,width:e,height:i,column:n}=this.option,o=document.createElement("canvas"),s=o.getContext("2d");return o.width=e*n,o.height=Math.ceil(t/n)*i+30,s.fillStyle="black",s.fillRect(0,0,o.width,o.height),s.font="14px Georgia",s.fillStyle="#fff",s.fillText(`From: https://artplayer.org/, Number: ${t}, Width: ${e}, Height: ${i}, Column: ${n}`,10,o.height-11),o}download(){this.errorHandle(this.file&&this.thumbnailUrl,"Download does not seem to be ready, please create previeLine truncated
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-tool-thumbnail.js v4.3.12
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,r,i){var o="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},s="function"==typeof o[r]&&o[r],a=s.i||{},c=s.cache||{},u="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function l(t,n){if(!c[t]){if(!e[t]){if(i[t])return i[t];var a="function"==typeof o[r]&&o[r];if(!n&&a)return a(t,!0);if(s)return s(t,!0);if(u&&"string"==typeof t)return u(t);var f=Error("Cannot find module '"+t+"'");throw f.code="MODULE_NOT_FOUND",f}p.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},p.cache={};var h=c[t]=new l.Module(t);e[t][0].call(h.exports,p,h,h.exports,o)}return c[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],r=e[1],i=e[2]||e[0],o=l(r);"*"===t?Object.keys(o).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:function(){return o[e]}})}):"*"===i?Object.defineProperty(n,t,{enumerable:!0,value:o}):Object.defineProperty(n,t,{enumerable:!0,get:function(){return"default"===i?o.__esModule?o.default:o:o[i]}})}),n}return l(t)}}l.isParcelRequire=!0,l.Module=function(e){this.id=e,this.bundle=l,this.require=u,this.exports={}},l.modules=e,l.cache=c,l.parent=s,l.distDir=void 0,l.publicUrl=void 0,l.devServer=void 0,l.i=a,l.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(l,"root",{get:function(){return o[r]}}),o[r]=l;for(var f=0;f<t.length;f++)l(t[f]);if(n){var h=l(n);"object"==typeof exports&&"u">typeof module?module.exports=h:"function"==typeof define&&define.amd&&define(function(){return h})}}({a05wP:[function(e,t,n,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"default",function(){return h});var o=e("@swc/helpers/cjs/_call_super.cjs"),s=e("@swc/helpers/cjs/_class_call_check.cjs"),a=e("@swc/helpers/cjs/_create_class.cjs"),c=e("@swc/helpers/cjs/_inherits.cjs"),u=e("./emitter"),l=i.interopDefault(u),f=e("./utils"),h=function(e){"use strict";function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,s._)(this,t),(e=(0,o._)(this,t)).processing=!1,e.option={},e.setup(Object.assign({},t.DEFAULTS,n)),e.video=t.creatVideo(),e.duration=0,e.inputChange=e.inputChange.bind(e),e.ondrop=e.ondrop.bind(e),e.option.fileInput.addEventListener("change",e.inputChange),e.option.fileInput.addEventListener("dragover",t.ondragover),e.option.fileInput.addEventListener("drop",t.ondrop),e}return(0,c._)(t,e),(0,a._)(t,[{key:"ondrop",value:function(e){e.preventDefault();var t=e.dataTransfer.files[0];this.loadVideo(t)}},{key:"setup",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.option=Object.assign({},this.option,t);var n=this.option,r=n.fileInput,i=n.number,o=n.width,s=n.column;if(this.errorHandle(r instanceof Element,"The 'fileInput' is not a Element"),"INPUT"!==r.tagName||"file"!==r.type){r.style.position="relative";var a=document.createElement("input");a.type="file",a.style.position="absolute",a.style.width="100%",a.style.height="100%",a.style.left="0",a.style.top="0",a.style.right="0",a.style.bottom="0",a.style.opacity="0",r.appendChild(a),this.option.fileInput=a}return["number","width","column","begin","end"].forEach(function(t){e.errorHandle("number"==typeof e.option[t],"The '".concat(t,"' is not a number"))}),this.option.number=(0,f.clamp)(i,10,1e3),this.option.width=(0,f.clamp)(o,10,1e3),this.option.column=(0,f.clamp)(s,1,1e3),this}},{key:"inputChange",value:function(e){var t=this.option.fileInput.files[0];this.loadVideo(t),e.target.value=""}},{key:"loadVideo",value:function(e){if(e){var t=this.video.canPlayType(e.type);this.errorHandle("maybe"===t||"probably"===t,"Playback of this file format is not supported: ".concat(e.type));var n=URL.createObjectURL(e);this.videoUrl=n,this.file=e,this.emit("file",this.file),this.video.src=n,this.emit("video",this.video)}}},{key:"start",value:function(){var e=this;if(!this.video.duration)return(0,f.sleep)(1e3).then(function(){return e.start()});var t=this.option,n=t.width,r=t.number,i=t.begin,o=t.end,s=this.video.videoHeight/this.video.videoWidth*n;this.option.height=s,this.option.begin=(0,f.clamp)(i,0,this.video.duration),this.option.end=(0,f.clamp)(o||this.video.duration,i,this.video.duration),this.errorHandle(this.option.end>this.option.begin,"End time must be greater than the start time"),this.duration=this.option.end-this.option.begin,this.density=r/this.duration,this.errorHandle(this.file&&this.video,"Please select the video file first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment..."),this.errorHandle(this.density<=1,"The preview density cannot be greater than 1, but got ".concat(this.density));var a=this.creatScreenshotDate(),c=this.creatCanvas(),u=c.getContext("2d");this.emit("canvas",c);var l=a.map(functLine truncated
|
||||
!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.ArtplayerToolThumbnail=e(),define(function(){return t.ArtplayerToolThumbnail})):(t="undefined"!==typeof globalThis?globalThis:t||self).ArtplayerToolThumbnail=e()}(this,function(){"use strict";class t{on(t,e,i){const n=this.e||(this.e={});return(n[t]||(n[t]=[])).push({fn:e,ctx:i}),this}once(t,e,i){const n=this;function o(...s){n.off(t,o),e.apply(i,s)}return o._=e,this.on(t,o,i)}emit(t,...e){const i=((this.e||(this.e={}))[t]||[]).slice();for(let n=0;n<i.length;n+=1)i[n].fn.apply(i[n].ctx,e);return this}off(t,e){const i=this.e||(this.e={}),n=i[t],o=[];if(n&&e)for(let s=0,r=n.length;s<r;s+=1)n[s].fn!==e&&n[s].fn._!==e&&o.push(n[s]);return o.length?i[t]=o:delete i[t],this}}function e(t,e,i){return Math.max(Math.min(t,Math.max(e,i)),Math.min(e,i))}class i extends t{constructor(t={}){super(),this.processing=!1,this.option={},this.setup(Object.assign({},i.DEFAULTS,t)),this.video=i.creatVideo(),this.duration=0,this.inputChange=this.inputChange.bind(this),this.ondrop=this.ondrop.bind(this),this.option.fileInput.addEventListener("change",this.inputChange),this.option.fileInput.addEventListener("dragover",i.ondragover),this.option.fileInput.addEventListener("drop",i.ondrop)}static get DEFAULTS(){return{number:60,width:160,height:90,column:10,begin:0,end:Number.NaN}}static ondragover(t){t.preventDefault()}ondrop(t){t.preventDefault();const e=t.dataTransfer.files[0];this.loadVideo(e)}setup(t={}){this.option=Object.assign({},this.option,t);const{fileInput:i,number:n,width:o,column:s}=this.option;if(this.errorHandle(i instanceof Element,"The 'fileInput' is not a Element"),"INPUT"!==i.tagName||"file"!==i.type){i.style.position="relative";const t=document.createElement("input");t.type="file",t.style.position="absolute",t.style.width="100%",t.style.height="100%",t.style.left="0",t.style.top="0",t.style.right="0",t.style.bottom="0",t.style.opacity="0",i.appendChild(t),this.option.fileInput=t}return["number","width","column","begin","end"].forEach(t=>{this.errorHandle("number"===typeof this.option[t],`The '${t}' is not a number`)}),this.option.number=e(n,10,1e3),this.option.width=e(o,10,1e3),this.option.column=e(s,1,1e3),this}static creatVideo(){const t=document.createElement("video");return t.style.position="absolute",t.style.top="-9999px",t.style.left="-9999px",t.muted=!0,t.controls=!0,document.body.appendChild(t),t}inputChange(t){const e=this.option.fileInput.files[0];this.loadVideo(e),t.target.value=""}loadVideo(t){if(t){const e=this.video.canPlayType(t.type);this.errorHandle("maybe"===e||"probably"===e,`Playback of this file format is not supported: ${t.type}`);const i=URL.createObjectURL(t);this.videoUrl=i,this.file=t,this.emit("file",this.file),this.video.src=i,this.emit("video",this.video)}}start(){if(!this.video.duration)return(t=1e3,new Promise(e=>setTimeout(e,t))).then(()=>this.start());var t;const{width:i,number:n,begin:o,end:s}=this.option,r=this.video.videoHeight/this.video.videoWidth*i;this.option.height=r,this.option.begin=e(o,0,this.video.duration),this.option.end=e(s||this.video.duration,o,this.video.duration),this.errorHandle(this.option.end>this.option.begin,"End time must be greater than the start time"),this.duration=this.option.end-this.option.begin,this.density=n/this.duration,this.errorHandle(this.file&&this.video,"Please select the video file first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment..."),this.errorHandle(this.density<=1,`The preview density cannot be greater than 1, but got ${this.density}`);const h=this.creatScreenshotDate(),a=this.creatCanvas(),l=a.getContext("2d");this.emit("canvas",a);const d=h.map((t,e)=>()=>new Promise(o=>{this.video.oncanplay=()=>{l.drawImage(this.video,t.x,t.y,i,r),a.toBlob(t=>{this.thumbnailUrl&&URL.revokeObjectURL(this.thumbnailUrl),this.thumbnailUrl=URL.createObjectURL(t),this.emit("update",this.thumbnailUrl,(e+1)/n),this.video.oncanplay=null,o()})},this.video.currentTime=t.time}));return this.processing=!0,(p=d,p.reduce((t,e)=>t.then(e),Promise.resolve())).then(()=>{this.processing=!1,this.emit("done")}).catch(t=>{throw this.processing=!1,this.emit("error",t.message),t});var p}creatScreenshotDate(){const{number:t,width:e,height:i,column:n,begin:o}=this.option,s=this.duration/t,r=[o+s];for(;r.length<t;){const t=r[r.length-1];r.push(t+s)}return r.map((t,o)=>({time:t-s/2,x:o%n*e,y:Math.floor(o/n)*i}))}creatCanvas(){const{number:t,width:e,height:i,column:n}=this.option,o=document.createElement("canvas"),s=o.getContext("2d");return o.width=e*n,o.height=Math.ceil(t/n)*i+30,s.fillStyle="black",s.fillRect(0,0,o.width,o.height),s.font="14px Georgia",s.fillStyle="#fff",s.fillText(`From: https://artplayer.org/, Number: ${t}, Width: ${e}, Height: ${i}, Column: ${n}`,10,o.height-11),o}download(){this.errorHandle(this.file&&this.thumbnailUrl,"Download does not seem to be ready, please create previeLine truncated
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer-tool-thumbnail.js v4.3.12
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,i,r,o){var n="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},s="function"==typeof n[r]&&n[r],l=s.i||{},a=s.cache||{},h="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(t,i){if(!a[t]){if(!e[t]){if(o[t])return o[t];var l="function"==typeof n[r]&&n[r];if(!i&&l)return l(t,!0);if(s)return s(t,!0);if(h&&"string"==typeof t)return h(t);var d=Error("Cannot find module '"+t+"'");throw d.code="MODULE_NOT_FOUND",d}c.resolve=function(i){var r=e[t][1][i];return null!=r?r:i},c.cache={};var p=a[t]=new u.Module(t);e[t][0].call(p.exports,c,p,p.exports,n)}return a[t].exports;function c(e){var t=c.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var i={__esModule:!0};return t.forEach(function(e){var t=e[0],r=e[1],o=e[2]||e[0],n=u(r);"*"===t?Object.keys(n).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(i,e)||Object.defineProperty(i,e,{enumerable:!0,get:function(){return n[e]}})}):"*"===o?Object.defineProperty(i,t,{enumerable:!0,value:n}):Object.defineProperty(i,t,{enumerable:!0,get:function(){return"default"===o?n.__esModule?n.default:n:n[o]}})}),i}return u(t)}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.require=h,this.exports={}},u.modules=e,u.cache=a,u.parent=s,u.distDir=void 0,u.publicUrl=void 0,u.devServer=void 0,u.i=l,u.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(u,"root",{get:function(){return n[r]}}),n[r]=u;for(var d=0;d<t.length;d++)u(t[d]);if(i){var p=u(i);"object"==typeof exports&&"u">typeof module?module.exports=p:"function"==typeof define&&define.amd&&define(function(){return p})}}({"81Ebp":[function(e,t,i,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(i);var n=e("./emitter"),s=o.interopDefault(n),l=e("./utils");class a extends s.default{constructor(e={}){super(),this.processing=!1,this.option={},this.setup(Object.assign({},a.DEFAULTS,e)),this.video=a.creatVideo(),this.duration=0,this.inputChange=this.inputChange.bind(this),this.ondrop=this.ondrop.bind(this),this.option.fileInput.addEventListener("change",this.inputChange),this.option.fileInput.addEventListener("dragover",a.ondragover),this.option.fileInput.addEventListener("drop",a.ondrop)}static get DEFAULTS(){return{number:60,width:160,height:90,column:10,begin:0,end:NaN}}static ondragover(e){e.preventDefault()}ondrop(e){e.preventDefault();let t=e.dataTransfer.files[0];this.loadVideo(t)}setup(e={}){this.option=Object.assign({},this.option,e);let{fileInput:t,number:i,width:r,column:o}=this.option;if(this.errorHandle(t instanceof Element,"The 'fileInput' is not a Element"),"INPUT"!==t.tagName||"file"!==t.type){t.style.position="relative";let e=document.createElement("input");e.type="file",e.style.position="absolute",e.style.width="100%",e.style.height="100%",e.style.left="0",e.style.top="0",e.style.right="0",e.style.bottom="0",e.style.opacity="0",t.appendChild(e),this.option.fileInput=e}return["number","width","column","begin","end"].forEach(e=>{this.errorHandle("number"==typeof this.option[e],`The '${e}' is not a number`)}),this.option.number=(0,l.clamp)(i,10,1e3),this.option.width=(0,l.clamp)(r,10,1e3),this.option.column=(0,l.clamp)(o,1,1e3),this}static creatVideo(){let e=document.createElement("video");return e.style.position="absolute",e.style.top="-9999px",e.style.left="-9999px",e.muted=!0,e.controls=!0,document.body.appendChild(e),e}inputChange(e){let t=this.option.fileInput.files[0];this.loadVideo(t),e.target.value=""}loadVideo(e){if(e){let t=this.video.canPlayType(e.type);this.errorHandle("maybe"===t||"probably"===t,`Playback of this file format is not supported: ${e.type}`);let i=URL.createObjectURL(e);this.videoUrl=i,this.file=e,this.emit("file",this.file),this.video.src=i,this.emit("video",this.video)}}start(){if(!this.video.duration)return(0,l.sleep)(1e3).then(()=>this.start());let{width:e,number:t,begin:i,end:r}=this.option,o=this.video.videoHeight/this.video.videoWidth*e;this.option.height=o,this.option.begin=(0,l.clamp)(i,0,this.video.duration),this.option.end=(0,l.clamp)(r||this.video.duration,i,this.video.duration),this.errorHandle(this.option.end>this.option.begin,"End time must be greater than the start time"),this.duration=this.option.end-this.option.begin,this.density=t/this.duration,this.errorHandle(this.file&&this.video,"Please select the video file first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment..."),this.errorHandle(this.density<=1,`The preview density cannot be greater than 1, but got ${this.density}`);let n=this.creatScreenshotDate(),s=this.creatCanvas(),a=s.getContext("2d");this.emit("canvas",s);let h=n.map((i,r)=>()=>new Promise(n=>{this.video.oncanplay=()=>{a.drawImage(this.video,i.x,i.y,e,o),s.toBlob(e=>{this.thumbnailUrl&&URL.revokeObjectURL(this.thumbnailUrl),this.thumbnailUrl=URL.createObjectURL(e),this.emit("update",thLine truncated
|
||||
class t{on(t,e,i){const n=this.e||(this.e={});return(n[t]||(n[t]=[])).push({fn:e,ctx:i}),this}once(t,e,i){const n=this;function o(...s){n.off(t,o),e.apply(i,s)}return o._=e,this.on(t,o,i)}emit(t,...e){const i=((this.e||(this.e={}))[t]||[]).slice();for(let n=0;n<i.length;n+=1)i[n].fn.apply(i[n].ctx,e);return this}off(t,e){const i=this.e||(this.e={}),n=i[t],o=[];if(n&&e)for(let s=0,r=n.length;s<r;s+=1)n[s].fn!==e&&n[s].fn._!==e&&o.push(n[s]);return o.length?i[t]=o:delete i[t],this}}function e(t,e,i){return Math.max(Math.min(t,Math.max(e,i)),Math.min(e,i))}class i extends t{constructor(t={}){super(),this.processing=!1,this.option={},this.setup(Object.assign({},i.DEFAULTS,t)),this.video=i.creatVideo(),this.duration=0,this.inputChange=this.inputChange.bind(this),this.ondrop=this.ondrop.bind(this),this.option.fileInput.addEventListener("change",this.inputChange),this.option.fileInput.addEventListener("dragover",i.ondragover),this.option.fileInput.addEventListener("drop",i.ondrop)}static get DEFAULTS(){return{number:60,width:160,height:90,column:10,begin:0,end:Number.NaN}}static ondragover(t){t.preventDefault()}ondrop(t){t.preventDefault();const e=t.dataTransfer.files[0];this.loadVideo(e)}setup(t={}){this.option=Object.assign({},this.option,t);const{fileInput:i,number:n,width:o,column:s}=this.option;if(this.errorHandle(i instanceof Element,"The 'fileInput' is not a Element"),"INPUT"!==i.tagName||"file"!==i.type){i.style.position="relative";const t=document.createElement("input");t.type="file",t.style.position="absolute",t.style.width="100%",t.style.height="100%",t.style.left="0",t.style.top="0",t.style.right="0",t.style.bottom="0",t.style.opacity="0",i.appendChild(t),this.option.fileInput=t}return["number","width","column","begin","end"].forEach(t=>{this.errorHandle("number"===typeof this.option[t],`The '${t}' is not a number`)}),this.option.number=e(n,10,1e3),this.option.width=e(o,10,1e3),this.option.column=e(s,1,1e3),this}static creatVideo(){const t=document.createElement("video");return t.style.position="absolute",t.style.top="-9999px",t.style.left="-9999px",t.muted=!0,t.controls=!0,document.body.appendChild(t),t}inputChange(t){const e=this.option.fileInput.files[0];this.loadVideo(e),t.target.value=""}loadVideo(t){if(t){const e=this.video.canPlayType(t.type);this.errorHandle("maybe"===e||"probably"===e,`Playback of this file format is not supported: ${t.type}`);const i=URL.createObjectURL(t);this.videoUrl=i,this.file=t,this.emit("file",this.file),this.video.src=i,this.emit("video",this.video)}}start(){if(!this.video.duration)return(t=1e3,new Promise(e=>setTimeout(e,t))).then(()=>this.start());var t;const{width:i,number:n,begin:o,end:s}=this.option,r=this.video.videoHeight/this.video.videoWidth*i;this.option.height=r,this.option.begin=e(o,0,this.video.duration),this.option.end=e(s||this.video.duration,o,this.video.duration),this.errorHandle(this.option.end>this.option.begin,"End time must be greater than the start time"),this.duration=this.option.end-this.option.begin,this.density=n/this.duration,this.errorHandle(this.file&&this.video,"Please select the video file first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment..."),this.errorHandle(this.density<=1,`The preview density cannot be greater than 1, but got ${this.density}`);const h=this.creatScreenshotDate(),a=this.creatCanvas(),l=a.getContext("2d");this.emit("canvas",a);const d=h.map((t,e)=>()=>new Promise(o=>{this.video.oncanplay=()=>{l.drawImage(this.video,t.x,t.y,i,r),a.toBlob(t=>{this.thumbnailUrl&&URL.revokeObjectURL(this.thumbnailUrl),this.thumbnailUrl=URL.createObjectURL(t),this.emit("update",this.thumbnailUrl,(e+1)/n),this.video.oncanplay=null,o()})},this.video.currentTime=t.time}));return this.processing=!0,(p=d,p.reduce((t,e)=>t.then(e),Promise.resolve())).then(()=>{this.processing=!1,this.emit("done")}).catch(t=>{throw this.processing=!1,this.emit("error",t.message),t});var p}creatScreenshotDate(){const{number:t,width:e,height:i,column:n,begin:o}=this.option,s=this.duration/t,r=[o+s];for(;r.length<t;){const t=r[r.length-1];r.push(t+s)}return r.map((t,o)=>({time:t-s/2,x:o%n*e,y:Math.floor(o/n)*i}))}creatCanvas(){const{number:t,width:e,height:i,column:n}=this.option,o=document.createElement("canvas"),s=o.getContext("2d");return o.width=e*n,o.height=Math.ceil(t/n)*i+30,s.fillStyle="black",s.fillRect(0,0,o.width,o.height),s.font="14px Georgia",s.fillStyle="#fff",s.fillText(`From: https://artplayer.org/, Number: ${t}, Width: ${e}, Height: ${i}, Column: ${n}`,10,o.height-11),o}download(){this.errorHandle(this.file&&this.thumbnailUrl,"Download does not seem to be ready, please create preview first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment...");const t=document.createElement("a"),e=`${function(t){const e=t.split(".");return e.pop(),e.join(".")}(this.file.name)}.png`;return t.download=e,t.href=this.thumbnailUrl,document.body.appendChild(t),t.click(),docuLine truncated
|
||||
Vendored
+2
-3
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer.js v5.3.1-beta.1
|
||||
* artplayer.js v5.3.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,a,o){var i="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},n="function"==typeof i[a]&&i[a],s=n.i||{},l=n.cache||{},c="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,r){if(!l[t]){if(!e[t]){if(o[t])return o[t];var s="function"==typeof i[a]&&i[a];if(!r&&s)return s(t,!0);if(n)return n(t,!0);if(c&&"string"==typeof t)return c(t);var d=Error("Cannot find module '"+t+"'");throw d.code="MODULE_NOT_FOUND",d}f.resolve=function(r){var a=e[t][1][r];return null!=a?a:r},f.cache={};var u=l[t]=new p.Module(t);e[t][0].call(u.exports,f,u,u.exports,i)}return l[t].exports;function f(e){var t=f.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],o=e[2]||e[0],i=p(a);"*"===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 p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=c,this.exports={}},p.modules=e,p.cache=l,p.parent=n,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=s,p.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(p,"root",{get:function(){return i[a]}}),i[a]=p;for(var d=0;d<t.length;d++)p(t[d]);if(r){var u=p(r);"object"==typeof exports&&"u">typeof module?module.exports=u:"function"==typeof define&&define.amd&&define(function(){return u})}}({"9IAQF":[function(e,t,r,a){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r);var i=e("bundle-text:./style/index.less"),n=o.interopDefault(i),s=e("option-validator"),l=o.interopDefault(s),c=e("../package.json"),p=e("./config"),d=o.interopDefault(p),u=e("./contextmenu"),f=o.interopDefault(u),h=e("./control"),m=o.interopDefault(h),g=e("./events"),v=o.interopDefault(g),y=e("./hotkey"),b=o.interopDefault(y),x=e("./i18n"),w=o.interopDefault(x),k=e("./icons"),j=o.interopDefault(k),$=e("./info"),S=o.interopDefault($),E=e("./layer"),I=o.interopDefault(E),M=e("./loading"),T=o.interopDefault(M),C=e("./mask"),F=o.interopDefault(C),D=e("./notice"),A=o.interopDefault(D),R=e("./player"),O=o.interopDefault(R),L=e("./plugins"),P=o.interopDefault(L),Y=e("./scheme"),z=o.interopDefault(Y),_=e("./setting"),H=o.interopDefault(_),V=e("./storage"),N=o.interopDefault(V),q=e("./subtitle"),B=o.interopDefault(q),U=e("./template"),W=o.interopDefault(U),Z=e("./utils"),K=e("./utils/emitter"),G=o.interopDefault(K);let X=0,J=[];class Q extends G.default{constructor(e,t){if(super(),!Z.isBrowser)throw Error("Artplayer can only be used in the browser environment");this.id=++X;const r=Z.mergeDeep(Q.option,e);if(r.container=e.container,this.option=(0,l.default)(r,z.default),this.isLock=!1,this.isReady=!1,this.isFocus=!1,this.isInput=!1,this.isRotate=!1,this.isDestroy=!1,this.template=new(0,W.default)(this),this.events=new(0,v.default)(this),this.storage=new(0,N.default)(this),this.icons=new(0,j.default)(this),this.i18n=new(0,w.default)(this),this.notice=new(0,A.default)(this),this.player=new(0,O.default)(this),this.layers=new(0,I.default)(this),this.controls=new(0,m.default)(this),this.contextmenu=new(0,f.default)(this),this.subtitle=new(0,B.default)(this),this.info=new(0,S.default)(this),this.loading=new(0,T.default)(this),this.hotkey=new(0,b.default)(this),this.mask=new(0,F.default)(this),this.setting=new(0,H.default)(this),this.plugins=new(0,P.default)(this),"function"==typeof t&&this.on("ready",()=>t.call(this,this)),Q.DEBUG){const e=e=>console.log(`[ART.${this.id}] -> ${e}`);e(`Version@${Q.version}`);for(let t=0;t<d.default.events.length;t++)this.on(`video:${d.default.events[t]}`,t=>e(`Event@${t.type}`))}J.push(this)}static get instances(){return J}static get version(){return c.version}static get config(){return d.default}static get utils(){return Z}static get scheme(){return z.default}static get Emitter(){return G.default}static get validator(){return l.default}static get kindOf(){return l.default.kindOf}static get html(){return W.default.html}static get option(){return{id:"",container:"#artplayer",url:"",poster:"",type:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,autoMini:!1,loop:!1,flip:!1,playbackRate:!1,aspectRatio:!1,screenshot:!1,setting:!1,hotkey:!0,pip:!1,mutex:!0,backdrop:!0,fullscreen:!1,fullscreenWeb:!1,subtitleOffset:!1,miniProgressBar:!1,useSSR:!1,playsInline:!0,lock:!1,gesture:!0,fastForward:!1,autoPlayback:!1,autoOrientation:!1,airplay:!1,proxy:void 0,layers:[],contextmenu:[],controls:[],settings:[],quality:[],highlight:[],plugins:[],thumbnails:{url:"",number:60,column:10,width:0,height:0,scale:1},subtitle:{url:"",type:"",style:{},name:"",escape:!0,encoding:"utf-8",onVttLoad:Line truncated
|
||||
!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.Artplayer=e(),define(function(){return t.Artplayer})):(t="undefined"!==typeof globalThis?globalThis:t||self).Artplayer=e()}(this,function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e,r={exports:{}};var a=(e||(e=1,r.exports=function(){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}var e=Object.prototype.toString,r=function(r){if(void 0===r)return"undefined";if(null===r)return"null";var o=t(r);if("boolean"===o)return"boolean";if("string"===o)return"string";if("number"===o)return"number";if("symbol"===o)return"symbol";if("function"===o)return"GeneratorFunction"===a(r)?"generatorfunction":"function";if(function(t){return Array.isArray?Array.isArray(t):t instanceof Array}(r))return"array";if(function(t){return!(!t.constructor||"function"!=typeof t.constructor.isBuffer)&&t.constructor.isBuffer(t)}(r))return"buffer";if(function(t){try{if("number"==typeof t.length&&"function"==typeof t.callee)return!0}catch(e){if(-1!==e.message.indexOf("callee"))return!0}return!1}(r))return"arguments";if(function(t){return t instanceof Date||"function"==typeof t.toDateString&&"function"==typeof t.getDate&&"function"==typeof t.setDate}(r))return"date";if(function(t){return t instanceof Error||"string"==typeof t.message&&t.constructor&&"number"==typeof t.constructor.stackTraceLimit}(r))return"error";if(function(t){return t instanceof RegExp||"string"==typeof t.flags&&"boolean"==typeof t.ignoreCase&&"boolean"==typeof t.multiline&&"boolean"==typeof t.global}(r))return"regexp";switch(a(r)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(function(t){return"function"==typeof t.throw&&"function"==typeof t.return&&"function"==typeof t.next}(r))return"generator";switch(o=e.call(r)){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return o.slice(8,-1).toLowerCase().replace(/\s/g,"")};function a(t){return t.constructor?t.constructor.name:null}function o(t,e){var a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:["option"];return n(t,e,a),i(t,e,a),function(t,e,a){var s=r(e),l=r(t);if("object"===s){if("object"!==l)throw new Error("[Type Error]: '".concat(a.join("."),"' require 'object' type, but got '").concat(l,"'"));Object.keys(e).forEach(function(r){var s=t[r],l=e[r],c=a.slice();c.push(r),n(s,l,c),i(s,l,c),o(s,l,c)})}if("array"===s){if("array"!==l)throw new Error("[Type Error]: '".concat(a.join("."),"' require 'array' type, but got '").concat(l,"'"));t.forEach(function(r,s){var l=t[s],c=e[s]||e[0],d=a.slice();d.push(s),n(l,c,d),i(l,c,d),o(l,c,d)})}}(t,e,a),t}function n(t,e,a){if("string"===r(e)){var o=r(t);if("?"===e[0]&&(e=e.slice(1)+"|undefined"),!(-1<e.indexOf("|")?e.split("|").map(function(t){return t.toLowerCase().trim()}).filter(Boolean).some(function(t){return o===t}):e.toLowerCase().trim()===o))throw new Error("[Type Error]: '".concat(a.join("."),"' require '").concat(e,"' type, but got '").concat(o,"'"))}}function i(t,e,a){if("function"===r(e)){var o=e(t,r(t),a);if(!0!==o){var n=r(o);throw"string"===n?new Error(o):"error"===n?o:new Error("[Validator Error]: The scheme for '".concat(a.join("."),"' validator require return true, but got '").concat(o,"'"))}}}return o.kindOf=r,o}()),r.exports);const o=t(a),n="5.3.1",i={properties:["audioTracks","autoplay","buffered","controller","controls","crossOrigin","currentSrc","currentTime","defaultMuted","defaultPlaybackRate","duration","ended","error","loop","mediaGroup","muted","networkState","paused","playbackRate","played","preload","readyState","seekable","seeking","src","startDate","textTracks","videoTracks","volume"],methods:["addTextTrack","canPlayType","load","play","pause"],events:["abort","canplay","canplaythrough","durationchange","emptied","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"],prototypes:["width","height","videoWidth","videoHeight","poster","webkitDecodedFrameCount","webkitDroppedFrameCount","playsInline","webLine truncated
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer.js v5.3.1-beta.1
|
||||
* artplayer.js v5.3.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,n,a){var o="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},s="function"==typeof o[n]&&o[n],i=s.i||{},l=s.cache||{},c="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(t,r){if(!l[t]){if(!e[t]){if(a[t])return a[t];var i="function"==typeof o[n]&&o[n];if(!r&&i)return i(t,!0);if(s)return s(t,!0);if(c&&"string"==typeof t)return c(t);var p=Error("Cannot find module '"+t+"'");throw p.code="MODULE_NOT_FOUND",p}d.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},d.cache={};var f=l[t]=new u.Module(t);e[t][0].call(f.exports,d,f,f.exports,o)}return l[t].exports;function d(e){var t=d.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=u(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 u(t)}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.require=c,this.exports={}},u.modules=e,u.cache=l,u.parent=s,u.distDir=void 0,u.publicUrl=void 0,u.devServer=void 0,u.i=i,u.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(u,"root",{get:function(){return o[n]}}),o[n]=u;for(var p=0;p<t.length;p++)u(t[p]);if(r){var f=u(r);"object"==typeof exports&&"u">typeof module?module.exports=f:"function"==typeof define&&define.amd&&define(function(){return f})}}({ee4D8:[function(e,t,r,n){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(r),a.export(r,"default",function(){return en});var o=e("@swc/helpers/cjs/_call_super.cjs"),s=e("@swc/helpers/cjs/_class_call_check.cjs"),i=e("@swc/helpers/cjs/_create_class.cjs"),l=e("@swc/helpers/cjs/_inherits.cjs"),c=e("bundle-text:./style/index.less"),u=a.interopDefault(c),p=e("option-validator"),f=a.interopDefault(p),d=e("../package.json"),h=e("./config"),m=a.interopDefault(h),v=e("./contextmenu"),g=a.interopDefault(v),y=e("./control"),b=a.interopDefault(y),j=e("./events"),w=a.interopDefault(j),_=e("./hotkey"),x=a.interopDefault(_),k=e("./i18n"),M=a.interopDefault(k),S=e("./icons"),E=a.interopDefault(S),I=e("./info"),T=a.interopDefault(I),C=e("./layer"),L=a.interopDefault(C),F=e("./loading"),D=a.interopDefault(F),O=e("./mask"),A=a.interopDefault(O),q=e("./notice"),$=a.interopDefault(q),R=e("./player"),P=a.interopDefault(R),H=e("./plugins"),z=a.interopDefault(H),V=e("./scheme"),N=a.interopDefault(V),U=e("./setting"),B=a.interopDefault(U),W=e("./storage"),Q=a.interopDefault(W),Y=e("./subtitle"),G=a.interopDefault(Y),Z=e("./template"),X=a.interopDefault(Z),K=e("./utils"),J=e("./utils/emitter"),ee=a.interopDefault(J),et=0,er=[],en=function(e){"use strict";function t(e,r){if((0,s._)(this,t),n=(0,o._)(this,t),!K.isBrowser)throw Error("Artplayer can only be used in the browser environment");n.id=++et;var n,a=K.mergeDeep(t.option,e);if(a.container=e.container,n.option=(0,f.default)(a,N.default),n.isLock=!1,n.isReady=!1,n.isFocus=!1,n.isInput=!1,n.isRotate=!1,n.isDestroy=!1,n.template=new(0,X.default)(n),n.events=new(0,w.default)(n),n.storage=new(0,Q.default)(n),n.icons=new(0,E.default)(n),n.i18n=new(0,M.default)(n),n.notice=new(0,$.default)(n),n.player=new(0,P.default)(n),n.layers=new(0,L.default)(n),n.controls=new(0,b.default)(n),n.contextmenu=new(0,g.default)(n),n.subtitle=new(0,G.default)(n),n.info=new(0,T.default)(n),n.loading=new(0,D.default)(n),n.hotkey=new(0,x.default)(n),n.mask=new(0,A.default)(n),n.setting=new(0,B.default)(n),n.plugins=new(0,z.default)(n),"function"==typeof r&&n.on("ready",function(){return r.call(n,n)}),t.DEBUG){var i=function(e){return console.log("[ART.".concat(n.id,"] -> ").concat(e))};i("Version@".concat(t.version));for(var l=0;l<m.default.events.length;l++)n.on("video:".concat(m.default.events[l]),function(e){return i("Event@".concat(e.type))})}return er.push(n),n}return(0,l._)(t,e),(0,i._)(t,[{key:"proxy",get:function(){return this.events.proxy}},{key:"query",get:function(){return this.template.query}},{key:"video",get:function(){return this.template.$video}},{key:"reset",value:function(){this.video.removeAttribute("src"),this.video.load()}},{key:"destroy",value:function(){var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];t.REMOVE_SRC_WHEN_DESTROY&&this.reset(),this.events.destroy(),this.template.destroy(e),er.splice(er.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}],[{key:"instances",get:function(){return er}},{key:"version",get:function(){return d.version}},{key:"config",get:function(){return m.default}},{key:"utils",get:function(){return K}},{key:"scheme",get:function(){return N.default}},{key:"Emitter",get:function(){return ee.default}},{key:"validator",Line truncated
|
||||
!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.Artplayer=e(),define(function(){return t.Artplayer})):(t="undefined"!==typeof globalThis?globalThis:t||self).Artplayer=e()}(this,function(){"use strict";var t,e=Object.defineProperty,r=Object.defineProperties,o=Object.getOwnPropertyDescriptors,a=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,s=(t,r,o)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[r]=o,l=(t,e)=>{for(var r in e||(e={}))n.call(e,r)&&s(t,r,e[r]);if(a)for(var r of a(e))i.call(e,r)&&s(t,r,e[r]);return t},c=(t,e)=>r(t,o(e)),d=(t,e,r)=>new Promise((o,a)=>{var n=t=>{try{s(r.next(t))}catch(e){a(e)}},i=t=>{try{s(r.throw(t))}catch(e){a(e)}},s=t=>t.done?o(t.value):Promise.resolve(t.value).then(n,i);s((r=r.apply(t,e)).next())});function p(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var h,u={exports:{}};var m=(h||(h=1,u.exports=function(){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}var e=Object.prototype.toString,r=function(r){if(void 0===r)return"undefined";if(null===r)return"null";var a=t(r);if("boolean"===a)return"boolean";if("string"===a)return"string";if("number"===a)return"number";if("symbol"===a)return"symbol";if("function"===a)return"GeneratorFunction"===o(r)?"generatorfunction":"function";if(function(t){return Array.isArray?Array.isArray(t):t instanceof Array}(r))return"array";if(function(t){return!(!t.constructor||"function"!=typeof t.constructor.isBuffer)&&t.constructor.isBuffer(t)}(r))return"buffer";if(function(t){try{if("number"==typeof t.length&&"function"==typeof t.callee)return!0}catch(e){if(-1!==e.message.indexOf("callee"))return!0}return!1}(r))return"arguments";if(function(t){return t instanceof Date||"function"==typeof t.toDateString&&"function"==typeof t.getDate&&"function"==typeof t.setDate}(r))return"date";if(function(t){return t instanceof Error||"string"==typeof t.message&&t.constructor&&"number"==typeof t.constructor.stackTraceLimit}(r))return"error";if(function(t){return t instanceof RegExp||"string"==typeof t.flags&&"boolean"==typeof t.ignoreCase&&"boolean"==typeof t.multiline&&"boolean"==typeof t.global}(r))return"regexp";switch(o(r)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(function(t){return"function"==typeof t.throw&&"function"==typeof t.return&&"function"==typeof t.next}(r))return"generator";switch(a=e.call(r)){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return a.slice(8,-1).toLowerCase().replace(/\s/g,"")};function o(t){return t.constructor?t.constructor.name:null}function a(t,e){var o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:["option"];return n(t,e,o),i(t,e,o),function(t,e,o){var s=r(e),l=r(t);if("object"===s){if("object"!==l)throw new Error("[Type Error]: '".concat(o.join("."),"' require 'object' type, but got '").concat(l,"'"));Object.keys(e).forEach(function(r){var s=t[r],l=e[r],c=o.slice();c.push(r),n(s,l,c),i(s,l,c),a(s,l,c)})}if("array"===s){if("array"!==l)throw new Error("[Type Error]: '".concat(o.join("."),"' require 'array' type, but got '").concat(l,"'"));t.forEach(function(r,s){var l=t[s],c=e[s]||e[0],d=o.slice();d.push(s),n(l,c,d),i(l,c,d),a(l,c,d)})}}(t,e,o),t}function n(t,e,o){if("string"===r(e)){var a=r(t);if("?"===e[0]&&(e=e.slice(1)+"|undefined"),!(-1<e.indexOf("|")?e.split("|").map(function(t){return t.toLowerCase().trim()}).filter(Boolean).some(function(t){return a===t}):e.toLowerCase().trim()===a))throw new Error("[Type Error]: '".concat(o.join("."),"' require '").concat(e,"' type, but got '").concat(a,"'"))}}function i(t,e,o){if("function"===r(e)){var a=e(t,r(t),o);if(!0!==a){var n=r(a);throw"string"===n?new Error(a):"error"===n?a:new Error("[Validator Error]: The scheme for '".concat(o.join("."),"' validator require return true, but got '").concat(a,"'"))}}}return a.kindOf=r,a}()),u.exports);const f=p(m),g="5.3.1",v={properties:["audioTracks","autoplay","buffered","controller","controls","crossOrigin","currentSrc","currentTime","defaultMuted","defaultPlaybackRate","duration","ended","error","loop","meLine truncated
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
|
||||
/*!
|
||||
* artplayer.js v5.3.1-beta.1
|
||||
* artplayer.js v5.3.1
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,a,o){var i="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},n="function"==typeof i[a]&&i[a],s=n.i||{},l=n.cache||{},c="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,r){if(!l[t]){if(!e[t]){if(o[t])return o[t];var s="function"==typeof i[a]&&i[a];if(!r&&s)return s(t,!0);if(n)return n(t,!0);if(c&&"string"==typeof t)return c(t);var d=Error("Cannot find module '"+t+"'");throw d.code="MODULE_NOT_FOUND",d}f.resolve=function(r){var a=e[t][1][r];return null!=a?a:r},f.cache={};var u=l[t]=new p.Module(t);e[t][0].call(u.exports,f,u,u.exports,i)}return l[t].exports;function f(e){var t=f.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],o=e[2]||e[0],i=p(a);"*"===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 p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=c,this.exports={}},p.modules=e,p.cache=l,p.parent=n,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=s,p.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(p,"root",{get:function(){return i[a]}}),i[a]=p;for(var d=0;d<t.length;d++)p(t[d]);if(r){var u=p(r);"object"==typeof exports&&"u">typeof module?module.exports=u:"function"==typeof define&&define.amd&&define(function(){return u})}}({esqvp:[function(e,t,r,a){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r);var i=e("bundle-text:./style/index.less"),n=o.interopDefault(i),s=e("option-validator"),l=o.interopDefault(s),c=e("../package.json"),p=e("./config"),d=o.interopDefault(p),u=e("./contextmenu"),f=o.interopDefault(u),h=e("./control"),m=o.interopDefault(h),g=e("./events"),v=o.interopDefault(g),y=e("./hotkey"),b=o.interopDefault(y),x=e("./i18n"),w=o.interopDefault(x),j=e("./icons"),k=o.interopDefault(j),E=e("./info"),S=o.interopDefault(E),$=e("./layer"),M=o.interopDefault($),I=e("./loading"),T=o.interopDefault(I),C=e("./mask"),F=o.interopDefault(C),q=e("./notice"),D=o.interopDefault(q),R=e("./player"),A=o.interopDefault(R),B=e("./plugins"),L=o.interopDefault(B),O=e("./scheme"),P=o.interopDefault(O),z=e("./setting"),X=o.interopDefault(z),_=e("./storage"),V=o.interopDefault(_),H=e("./subtitle"),N=o.interopDefault(H),W=e("./template"),U=o.interopDefault(W),Y=e("./utils"),Z=e("./utils/emitter"),G=o.interopDefault(Z);let K=0,J=[];class Q extends G.default{constructor(e,t){if(super(),!Y.isBrowser)throw Error("Artplayer can only be used in the browser environment");this.id=++K;let r=Y.mergeDeep(Q.option,e);if(r.container=e.container,this.option=(0,l.default)(r,P.default),this.isLock=!1,this.isReady=!1,this.isFocus=!1,this.isInput=!1,this.isRotate=!1,this.isDestroy=!1,this.template=new(0,U.default)(this),this.events=new(0,v.default)(this),this.storage=new(0,V.default)(this),this.icons=new(0,k.default)(this),this.i18n=new(0,w.default)(this),this.notice=new(0,D.default)(this),this.player=new(0,A.default)(this),this.layers=new(0,M.default)(this),this.controls=new(0,m.default)(this),this.contextmenu=new(0,f.default)(this),this.subtitle=new(0,N.default)(this),this.info=new(0,S.default)(this),this.loading=new(0,T.default)(this),this.hotkey=new(0,b.default)(this),this.mask=new(0,F.default)(this),this.setting=new(0,X.default)(this),this.plugins=new(0,L.default)(this),"function"==typeof t&&this.on("ready",()=>t.call(this,this)),Q.DEBUG){let e=e=>console.log(`[ART.${this.id}] -> ${e}`);e(`Version@${Q.version}`);for(let t=0;t<d.default.events.length;t++)this.on(`video:${d.default.events[t]}`,t=>e(`Event@${t.type}`))}J.push(this)}static get instances(){return J}static get version(){return c.version}static get config(){return d.default}static get utils(){return Y}static get scheme(){return P.default}static get Emitter(){return G.default}static get validator(){return l.default}static get kindOf(){return l.default.kindOf}static get html(){return U.default.html}static get option(){return{id:"",container:"#artplayer",url:"",poster:"",type:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,autoMini:!1,loop:!1,flip:!1,playbackRate:!1,aspectRatio:!1,screenshot:!1,setting:!1,hotkey:!0,pip:!1,mutex:!0,backdrop:!0,fullscreen:!1,fullscreenWeb:!1,subtitleOffset:!1,miniProgressBar:!1,useSSR:!1,playsInline:!0,lock:!1,gesture:!0,fastForward:!1,autoPlayback:!1,autoOrientation:!1,airplay:!1,proxy:void 0,layers:[],contextmenu:[],controls:[],settings:[],quality:[],highlight:[],plugins:[],thumbnails:{url:"",number:60,column:10,width:0,height:0,scale:1},subtitle:{url:"",type:"",style:{},name:"",escape:!0,encoding:"utf-8",onVttLoad:e=>e},Line truncated
|
||||
function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e,r={exports:{}};const a=/* @__PURE__ */t((e||(e=1,r.exports=function(){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}var e=Object.prototype.toString,r=function(r){if(void 0===r)return"undefined";if(null===r)return"null";var o=t(r);if("boolean"===o)return"boolean";if("string"===o)return"string";if("number"===o)return"number";if("symbol"===o)return"symbol";if("function"===o)return"GeneratorFunction"===a(r)?"generatorfunction":"function";if(function(t){return Array.isArray?Array.isArray(t):t instanceof Array}(r))return"array";if(function(t){return!(!t.constructor||"function"!=typeof t.constructor.isBuffer)&&t.constructor.isBuffer(t)}(r))return"buffer";if(function(t){try{if("number"==typeof t.length&&"function"==typeof t.callee)return!0}catch(e){if(-1!==e.message.indexOf("callee"))return!0}return!1}(r))return"arguments";if(function(t){return t instanceof Date||"function"==typeof t.toDateString&&"function"==typeof t.getDate&&"function"==typeof t.setDate}(r))return"date";if(function(t){return t instanceof Error||"string"==typeof t.message&&t.constructor&&"number"==typeof t.constructor.stackTraceLimit}(r))return"error";if(function(t){return t instanceof RegExp||"string"==typeof t.flags&&"boolean"==typeof t.ignoreCase&&"boolean"==typeof t.multiline&&"boolean"==typeof t.global}(r))return"regexp";switch(a(r)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(function(t){return"function"==typeof t.throw&&"function"==typeof t.return&&"function"==typeof t.next}(r))return"generator";switch(o=e.call(r)){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return o.slice(8,-1).toLowerCase().replace(/\s/g,"")};function a(t){return t.constructor?t.constructor.name:null}function o(t,e){var a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:["option"];return n(t,e,a),i(t,e,a),function(t,e,a){var s=r(e),l=r(t);if("object"===s){if("object"!==l)throw new Error("[Type Error]: '".concat(a.join("."),"' require 'object' type, but got '").concat(l,"'"));Object.keys(e).forEach(function(r){var s=t[r],l=e[r],c=a.slice();c.push(r),n(s,l,c),i(s,l,c),o(s,l,c)})}if("array"===s){if("array"!==l)throw new Error("[Type Error]: '".concat(a.join("."),"' require 'array' type, but got '").concat(l,"'"));t.forEach(function(r,s){var l=t[s],c=e[s]||e[0],d=a.slice();d.push(s),n(l,c,d),i(l,c,d),o(l,c,d)})}}(t,e,a),t}function n(t,e,a){if("string"===r(e)){var o=r(t);if("?"===e[0]&&(e=e.slice(1)+"|undefined"),!(-1<e.indexOf("|")?e.split("|").map(function(t){return t.toLowerCase().trim()}).filter(Boolean).some(function(t){return o===t}):e.toLowerCase().trim()===o))throw new Error("[Type Error]: '".concat(a.join("."),"' require '").concat(e,"' type, but got '").concat(o,"'"))}}function i(t,e,a){if("function"===r(e)){var o=e(t,r(t),a);if(!0!==o){var n=r(o);throw"string"===n?new Error(o):"error"===n?o:new Error("[Validator Error]: The scheme for '".concat(a.join("."),"' validator require return true, but got '").concat(o,"'"))}}}return o.kindOf=r,o}()),r.exports)),o="5.3.1",n={properties:["audioTracks","autoplay","buffered","controller","controls","crossOrigin","currentSrc","currentTime","defaultMuted","defaultPlaybackRate","duration","ended","error","loop","mediaGroup","muted","networkState","paused","playbackRate","played","preload","readyState","seekable","seeking","src","startDate","textTracks","videoTracks","volume"],methods:["addTextTrack","canPlayType","load","play","pause"],events:["abort","canplay","canplaythrough","durationchange","emptied","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"],prototypes:["width","height","videoWidth","videoHeight","poster","webkitDecodedFrameCount","webkitDroppedFrameCount","playsInline","webkitSupportsFullscreen","webkitDisplayingFullscreen","onenterpictureinpicture","onleavepictureinpicture","disablePictureInPicture","cancelVideoFrameCallback","requestVideoFrameCallback","getVideoPlaybackQuality","requestPictureInPicture","webkitEnterFullScreen","webkitEnterFulLine truncated
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
!function(e,t,r,o,n){var i="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},u="function"==typeof i[o]&&i[o],l=u.i||{},f=u.cache||{},a="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,r){if(!f[t]){if(!e[t]){if(n[t])return n[t];var l="function"==typeof i[o]&&i[o];if(!r&&l)return l(t,!0);if(u)return u(t,!0);if(a&&"string"==typeof t)return a(t);var d=Error("Cannot find module '"+t+"'");throw d.code="MODULE_NOT_FOUND",d}p.resolve=function(r){var o=e[t][1][r];return null!=o?o:r},p.cache={};var s=f[t]=new c.Module(t);e[t][0].call(s.exports,p,s,s.exports,i)}return f[t].exports;function p(e){var t=p.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],i=c(o);"*"===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]}})}):"*"===n?Object.defineProperty(r,t,{enumerable:!0,value:i}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===n?i.__esModule?i.default:i:i[n]}})}),r}return c(t)}}c.isParcelRequire=!0,c.Module=function(e){this.id=e,this.bundle=c,this.require=a,this.exports={}},c.modules=e,c.cache=f,c.parent=u,c.distDir=void 0,c.publicUrl=void 0,c.devServer=void 0,c.i=l,c.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(c,"root",{get:function(){return i[o]}}),i[o]=c;for(var d=0;d<t.length;d++)c(t[d]);if(r){var s=c(r);"object"==typeof exports&&"u">typeof module?module.exports=s:"function"==typeof define&&define.amd&&define(function(){return s})}}({kSJYW:[function(e,t,r,o){e("@parcel/transformer-js/src/esmodule-helpers.js").defineInteropFlag(r);let n={"Video Info":"معلومات الفيديو",Close:"إغلاق","Video Load Failed":"فشل تحميل الفيديو",Volume:"الصوت",Play:"تشغيل",Pause:"إيقاف مؤقت",Rate:"السرعة",Mute:"كتم الصوت","Video Flip":"تدوير الفيديو",Horizontal:"أفقي",Vertical:"عمودي",Reconnect:"إعادة الاتصال","Show Setting":"إظهار الإعدادات","Hide Setting":"إخفاء الإعدادات",Screenshot:"لقطة شاشة","Play Speed":"سرعة التشغيل","Aspect Ratio":"نسبة العرض إلى الارتفاع",Default:"افتراضي",Normal:"عادي",Open:"فتح","Switch Video":"تبديل الفيديو","Switch Subtitle":"تبديل الترجمة",Fullscreen:"وضع ملء الشاشة","Exit Fullscreen":"الخروج من وضع ملء الشاشة","Web Fullscreen":"وضع ملء الشاشة في المتصفح","Exit Web Fullscreen":"الخروج من وضع ملء الشاشة في المتصفح","Mini Player":"مشغل صغير","PIP Mode":"الوضع العائم","Exit PIP Mode":"الخروج من الوضع العائم","PIP Not Supported":"الوضع العائم غير مدعوم","Fullscreen Not Supported":"وضع ملء الشاشة غير مدعوم","Subtitle Offset":"إزاحة الترجمة","Last Seen":"آخر مشاهدة","Jump Play":"التشغيل القافز",AirPlay:"AirPlay","AirPlay Not Available":"AirPlay غير متاح"};r.default=n,"u">typeof window&&(window["artplayer-i18n-ar"]=n)},{"@parcel/transformer-js/src/esmodule-helpers.js":"8BZVg"}],"8BZVg":[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})}},{}]},["kSJYW"],"kSJYW","parcelRequire4dc0",{});
|
||||
(function(e,t){typeof exports=="object"&&typeof module<"u"?module.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self,e.artplayerI18nAr=t())})(this,(function(){"use strict";const e={"Video Info":"معلومات الفيديو",Close:"إغلاق","Video Load Failed":"فشل تحميل الفيديو",Volume:"الصوت",Play:"تشغيل",Pause:"إيقاف مؤقت",Rate:"السرعة",Mute:"كتم الصوت","Video Flip":"تدوير الفيديو",Horizontal:"أفقي",Vertical:"عمودي",Reconnect:"إعادة الاتصال","Show Setting":"إظهار الإعدادات","Hide Setting":"إخفاء الإعدادات",Screenshot:"لقطة شاشة","Play Speed":"سرعة التشغيل","Aspect Ratio":"نسبة العرض إلى الارتفاع",Default:"افتراضي",Normal:"عادي",Open:"فتح","Switch Video":"تبديل الفيديو","Switch Subtitle":"تبديل الترجمة",Fullscreen:"وضع ملء الشاشة","Exit Fullscreen":"الخروج من وضع ملء الشاشة","Web Fullscreen":"وضع ملء الشاشة في المتصفح","Exit Web Fullscreen":"الخروج من وضع ملء الشاشة في المتصفح","Mini Player":"مشغل صغير","PIP Mode":"الوضع العائم","Exit PIP Mode":"الخروج من الوضع العائم","PIP Not Supported":"الوضع العائم غير مدعوم","Fullscreen Not Supported":"وضع ملء الشاشة غير مدعوم","Subtitle Offset":"إزاحة الترجمة","Last Seen":"آخر مشاهدة","Jump Play":"التشغيل القافز",AirPlay:"AirPlay","AirPlay Not Available":"AirPlay غير متاح"};return typeof window<"u"&&(window["artplayer-i18n-ar"]=e),e}));
|
||||
Vendored
+42
-1
@@ -1 +1,42 @@
|
||||
!function(e,t,r,o,n){var u="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},i="function"==typeof u[o]&&u[o],l=i.i||{},f=i.cache||{},a="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,r){if(!f[t]){if(!e[t]){if(n[t])return n[t];var l="function"==typeof u[o]&&u[o];if(!r&&l)return l(t,!0);if(i)return i(t,!0);if(a&&"string"==typeof t)return a(t);var d=Error("Cannot find module '"+t+"'");throw d.code="MODULE_NOT_FOUND",d}s.resolve=function(r){var o=e[t][1][r];return null!=o?o:r},s.cache={};var p=f[t]=new c.Module(t);e[t][0].call(p.exports,s,p,p.exports,u)}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],o=e[1],n=e[2]||e[0],u=c(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 c(t)}}c.isParcelRequire=!0,c.Module=function(e){this.id=e,this.bundle=c,this.require=a,this.exports={}},c.modules=e,c.cache=f,c.parent=i,c.distDir=void 0,c.publicUrl=void 0,c.devServer=void 0,c.i=l,c.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(c,"root",{get:function(){return u[o]}}),u[o]=c;for(var d=0;d<t.length;d++)c(t[d]);if(r){var p=c(r);"object"==typeof exports&&"u">typeof module?module.exports=p:"function"==typeof define&&define.amd&&define(function(){return p})}}({"4MZIb":[function(e,t,r,o){e("@parcel/transformer-js/src/esmodule-helpers.js").defineInteropFlag(r);let n={"Video Info":"معلومات الفيديو",Close:"إغلاق","Video Load Failed":"فشل تحميل الفيديو",Volume:"الصوت",Play:"تشغيل",Pause:"إيقاف مؤقت",Rate:"السرعة",Mute:"كتم الصوت","Video Flip":"تدوير الفيديو",Horizontal:"أفقي",Vertical:"عمودي",Reconnect:"إعادة الاتصال","Show Setting":"إظهار الإعدادات","Hide Setting":"إخفاء الإعدادات",Screenshot:"لقطة شاشة","Play Speed":"سرعة التشغيل","Aspect Ratio":"نسبة العرض إلى الارتفاع",Default:"افتراضي",Normal:"عادي",Open:"فتح","Switch Video":"تبديل الفيديو","Switch Subtitle":"تبديل الترجمة",Fullscreen:"وضع ملء الشاشة","Exit Fullscreen":"الخروج من وضع ملء الشاشة","Web Fullscreen":"وضع ملء الشاشة في المتصفح","Exit Web Fullscreen":"الخروج من وضع ملء الشاشة في المتصفح","Mini Player":"مشغل صغير","PIP Mode":"الوضع العائم","Exit PIP Mode":"الخروج من الوضع العائم","PIP Not Supported":"الوضع العائم غير مدعوم","Fullscreen Not Supported":"وضع ملء الشاشة غير مدعوم","Subtitle Offset":"إزاحة الترجمة","Last Seen":"آخر مشاهدة","Jump Play":"التشغيل القافز",AirPlay:"AirPlay","AirPlay Not Available":"AirPlay غير متاح"};r.default=n,"u">typeof window&&(window["artplayer-i18n-ar"]=n)},{"@parcel/transformer-js/src/esmodule-helpers.js":"60D0X"}],"60D0X":[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})}},{}]},["4MZIb"],"4MZIb","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("4MZIb");export{e as default};
|
||||
const e = {
|
||||
"Video Info": "معلومات الفيديو",
|
||||
Close: "إغلاق",
|
||||
"Video Load Failed": "فشل تحميل الفيديو",
|
||||
Volume: "الصوت",
|
||||
Play: "تشغيل",
|
||||
Pause: "إيقاف مؤقت",
|
||||
Rate: "السرعة",
|
||||
Mute: "كتم الصوت",
|
||||
"Video Flip": "تدوير الفيديو",
|
||||
Horizontal: "أفقي",
|
||||
Vertical: "عمودي",
|
||||
Reconnect: "إعادة الاتصال",
|
||||
"Show Setting": "إظهار الإعدادات",
|
||||
"Hide Setting": "إخفاء الإعدادات",
|
||||
Screenshot: "لقطة شاشة",
|
||||
"Play Speed": "سرعة التشغيل",
|
||||
"Aspect Ratio": "نسبة العرض إلى الارتفاع",
|
||||
Default: "افتراضي",
|
||||
Normal: "عادي",
|
||||
Open: "فتح",
|
||||
"Switch Video": "تبديل الفيديو",
|
||||
"Switch Subtitle": "تبديل الترجمة",
|
||||
Fullscreen: "وضع ملء الشاشة",
|
||||
"Exit Fullscreen": "الخروج من وضع ملء الشاشة",
|
||||
"Web Fullscreen": "وضع ملء الشاشة في المتصفح",
|
||||
"Exit Web Fullscreen": "الخروج من وضع ملء الشاشة في المتصفح",
|
||||
"Mini Player": "مشغل صغير",
|
||||
"PIP Mode": "الوضع العائم",
|
||||
"Exit PIP Mode": "الخروج من الوضع العائم",
|
||||
"PIP Not Supported": "الوضع العائم غير مدعوم",
|
||||
"Fullscreen Not Supported": "وضع ملء الشاشة غير مدعوم",
|
||||
"Subtitle Offset": "إزاحة الترجمة",
|
||||
"Last Seen": "آخر مشاهدة",
|
||||
"Jump Play": "التشغيل القافز",
|
||||
AirPlay: "AirPlay",
|
||||
"AirPlay Not Available": "AirPlay غير متاح"
|
||||
};
|
||||
typeof window < "u" && (window["artplayer-i18n-ar"] = e);
|
||||
export {
|
||||
e as default
|
||||
};
|
||||
Loaded 100 of 397 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user