mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 01:21:20 -08:00
build all
Refactor utility functions for improved readability and consistency - Updated compatibility.js to use consistent line endings and formatting. - Refactored component.js for better readability and structure, including consistent use of arrow functions and binding. - Simplified dom.js functions with consistent formatting and improved readability. - Enhanced emitter.js with consistent formatting and arrow function usage. - Streamlined error.js for improved readability and consistency. - Refactored file.js to use consistent formatting and improved readability. - Improved format.js functions for better readability and consistency. - Updated index.js to maintain consistent export formatting. - Refactored property.js for improved readability and consistency. - Enhanced subtitle.js with consistent formatting and improved readability. - Refactored time.js for better readability and consistent formatting. fix: update lint script to target only source files for consistency Revert "fix: restore export statements for various plugins and update type definitions for better clarity" This reverts commit b5e969d81ec765cd8a34b06e6ef4f232ef25087f. fix: restore export statements for various plugins and update type definitions for better clarity Refactor type definitions to use interfaces instead of type aliases for better extensibility and clarity across i18n, icons, option, player, quality, setting, subtitle, template, and utils modules.
This commit is contained in:
1 parent
532dd67cfd
commit
35ad9883af
447 files changed
+18248
-17946
No files matched your search
@@ -5,5 +5,5 @@
|
||||
* (c) 2017-2025 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,n,l,t,i,a,r,o){var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},p="function"==typeof d[t]&&d[t],s=p.i||{},u=p.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function y(n,l){if(!u[n]){if(!e[n]){if(i[n])return i[n];var a="function"==typeof d[t]&&d[t];if(!l&&a)return a(n,!0);if(p)return p(n,!0);if(c&&"string"==typeof n)return c(n);var r=Error("Cannot find module '"+n+"'");throw r.code="MODULE_NOT_FOUND",r}s.resolve=function(l){var t=e[n][1][l];return null!=t?t:l},s.cache={};var o=u[n]=new y.Module(n);e[n][0].call(o.exports,s,o,o.exports,d)}return u[n].exports;function s(e){var n=s.resolve(e);return!1===n?{}:y(n)}}y.isParcelRequire=!0,y.Module=function(e){this.id=e,this.bundle=y,this.require=c,this.exports={}},y.modules=e,y.cache=u,y.parent=p,y.distDir=void 0,y.publicUrl=void 0,y.devServer=void 0,y.i=s,y.register=function(n,l){e[n]=[function(e,n){n.exports=l},{}]},Object.defineProperty(y,"root",{get:function(){return d[t]}}),d[t]=y;for(var f=0;f<n.length;f++)y(n[f]);if(l){var g=y(l);"object"==typeof exports&&"undefined"!=typeof module?module.exports=g:"function"==typeof define&&define.amd&&define(function(){return g})}}({"4omrA":[function(e,n,l,t){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(l),i.export(l,"default",()=>o);var a=e("bundle-text:./style.less"),r=i.interopDefault(a);function o(e){return n=>{let{version:l,utils:{errorHandle:t}}=n.constructor,i=l.split(".").map(Number);t(i[0]+i[1]/100>=5,`Artplayer.js@${l} is not compatible the artplayerPluginAds@${o.version}. Please update it to version Artplayer.js@5.x.x`);let{template:{$player:a},icons:{volume:r,volumeClose:d,fullscreenOn:p,fullscreenOff:s,loading:u},constructor:{validator:c,utils:{query:y,append:f,setStyle:g}}}=n;e=c({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 m=null,v=null,x=null,h=null,b=null,w=null,D=0,j=null,A=!1,P=!1,$=!1;function k(e,n){return n.replace("%s",e)}function O(){A=!0,n.play(),e.video&&m.pause(),g(n.template.$ads,"display","none"),n.emit("artplayerPluginAds:skip",e)}function M(){A||(j=setTimeout(()=>{D+=1;let n=e.playDuration-D;n>=1?x.innerHTML=k(n,e.i18n.canBeClosed):(x.innerHTML=e.i18n.close,$||($=!0)),h.innerHTML=k(e.totalDuration-D,e.i18n.countdown),D>=e.totalDuration?O():M()},1e3))}function _(){A||clearTimeout(j)}function T(){P||(P=!0,function(){n.template.$ads=f(a,'<div class="artplayer-plugin-ads"></div>'),m=f(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>`),w=f(n.template.$ads,'<div class="artplayer-plugin-ads-loading"></div>'),f(w,u),x=y(".artplayer-plugin-ads-close",v=f(n.template.$ads,`<div class="artplayer-plugin-ads-timer"><div class="artplayer-plugin-ads-close">${e.playDuration<=0?e.i18n.close:k(e.playDuration,e.i18n.canBeClosed)}</div><div class="artplayer-plugin-ads-countdown">${k(e.totalDuration,e.i18n.countdown)}</div></div>`)),h=y(".artplayer-plugin-ads-countdown",v),e.playDuration>=e.totalDuration&&g(x,"display","none"),n.proxy(x,"click",()=>{$&&O()});let l=y(".artplayer-plugin-ads-detail",b=f(n.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>`)),t=y(".artplayer-plugin-ads-muted",b),i=y(".artplayer-plugin-ads-fullscreen",b);if(e.url?n.proxy(l,"click",()=>{window.open(e.url),n.emit("artplayerPluginAds:click",e)}):g(l,"display","none"),e.video){let l=f(t,r),i=f(t,d);g(i,"display","none"),e.muted&&(m.muted=!0,g(l,"display","none"),g(i,"display","inline-flex")),n.proxy(t,"click",()=>{m.muted=!m.muted,m.muted?(g(l,"display","none"),g(i,"display","inline-flex")):(g(l,"display","inline-flex"),g(i,"display","none"))})}else g(t,"display","none");let o=f(i,p),c=f(i,s);g(c,"display","none"),n.proxy(i,"click",()=>{n.fullscreen=!n.fullscreen,n.fullscreen?(g(o,"display","inline-flex"),g(c,"display","none")):(g(o,"display","none"),g(c,"display","inline-flex"))}),n.proxy(m,"click",()=>{e.url&&window.open(e.url),n.emit("artplayerPluginAds:click",e)})}(),n.pause(),e.video?(n.proxy(m,"error",O),n.proxy(m,"loadedmetadata",()=>{M(),m.play(),g(v,"display","flex"),g(b,"display","flex"),g(w,"display","none")})):(M(),g(v,"display","flex"),g(b,"display","flex"),g(w,"display","none")),n.proxy(document,"visibilitychange",()=>{document.hidden?_():M()}))}return n.on("ready",()=>{n.once("play",T),n.once("video:playing",T)}),{name:"arLine truncated
|
||||
!function(e,n,l,t,i,a,r,o){var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},p="function"==typeof d[t]&&d[t],s=p.i||{},u=p.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function y(n,l){if(!u[n]){if(!e[n]){if(i[n])return i[n];var a="function"==typeof d[t]&&d[t];if(!l&&a)return a(n,!0);if(p)return p(n,!0);if(c&&"string"==typeof n)return c(n);var r=Error("Cannot find module '"+n+"'");throw r.code="MODULE_NOT_FOUND",r}s.resolve=function(l){var t=e[n][1][l];return null!=t?t:l},s.cache={};var o=u[n]=new y.Module(n);e[n][0].call(o.exports,s,o,o.exports,d)}return u[n].exports;function s(e){var n=s.resolve(e);return!1===n?{}:y(n)}}y.isParcelRequire=!0,y.Module=function(e){this.id=e,this.bundle=y,this.require=c,this.exports={}},y.modules=e,y.cache=u,y.parent=p,y.distDir=void 0,y.publicUrl=void 0,y.devServer=void 0,y.i=s,y.register=function(n,l){e[n]=[function(e,n){n.exports=l},{}]},Object.defineProperty(y,"root",{get:function(){return d[t]}}),d[t]=y;for(var f=0;f<n.length;f++)y(n[f]);if(l){var g=y(l);"object"==typeof exports&&"undefined"!=typeof module?module.exports=g:"function"==typeof define&&define.amd&&define(function(){return g})}}({"2Uydo":[function(e,n,l,t){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(l),i.export(l,"default",()=>o);var a=e("bundle-text:./style.less"),r=i.interopDefault(a);function o(e){return n=>{let{version:l,utils:{errorHandle:t}}=n.constructor,i=l.split(".").map(Number);t(i[0]+i[1]/100>=5,`Artplayer.js@${l} is not compatible the artplayerPluginAds@${o.version}. Please update it to version Artplayer.js@5.x.x`);let{template:{$player:a},icons:{volume:r,volumeClose:d,fullscreenOn:p,fullscreenOff:s,loading:u},constructor:{validator:c,utils:{query:y,append:f,setStyle:g}}}=n;e=c({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 m=null,v=null,x=null,h=null,b=null,w=null,D=0,j=null,P=!1,$=!1,k=!1;function M(e,n){return n.replace("%s",e)}function O(){P=!0,n.play(),e.video&&m.pause(),g(n.template.$ads,"display","none"),n.emit("artplayerPluginAds:skip",e)}function A(){P||(j=setTimeout(()=>{D+=1;let n=e.playDuration-D;n>=1?x.innerHTML=M(n,e.i18n.canBeClosed):(x.innerHTML=e.i18n.close,k||(k=!0)),h.innerHTML=M(e.totalDuration-D,e.i18n.countdown),D>=e.totalDuration?O():A()},1e3))}function _(){P||clearTimeout(j)}function T(){$||($=!0,function(){n.template.$ads=f(a,'<div class="artplayer-plugin-ads"></div>'),m=f(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>`),w=f(n.template.$ads,'<div class="artplayer-plugin-ads-loading"></div>'),f(w,u),x=y(".artplayer-plugin-ads-close",v=f(n.template.$ads,`<div class="artplayer-plugin-ads-timer"><div class="artplayer-plugin-ads-close">${e.playDuration<=0?e.i18n.close:M(e.playDuration,e.i18n.canBeClosed)}</div><div class="artplayer-plugin-ads-countdown">${M(e.totalDuration,e.i18n.countdown)}</div></div>`)),h=y(".artplayer-plugin-ads-countdown",v),e.playDuration>=e.totalDuration&&g(x,"display","none"),n.proxy(x,"click",()=>{k&&O()});let l=y(".artplayer-plugin-ads-detail",b=f(n.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>`)),t=y(".artplayer-plugin-ads-muted",b),i=y(".artplayer-plugin-ads-fullscreen",b);if(e.url?n.proxy(l,"click",()=>{window.open(e.url),n.emit("artplayerPluginAds:click",e)}):g(l,"display","none"),e.video){let l=f(t,r),i=f(t,d);g(i,"display","none"),e.muted&&(m.muted=!0,g(l,"display","none"),g(i,"display","inline-flex")),n.proxy(t,"click",()=>{m.muted=!m.muted,m.muted?(g(l,"display","none"),g(i,"display","inline-flex")):(g(l,"display","inline-flex"),g(i,"display","none"))})}else g(t,"display","none");let o=f(i,p),c=f(i,s);g(c,"display","none"),n.proxy(i,"click",()=>{n.fullscreen=!n.fullscreen,n.fullscreen?(g(o,"display","inline-flex"),g(c,"display","none")):(g(o,"display","none"),g(c,"display","inline-flex"))}),n.proxy(m,"click",()=>{e.url&&window.open(e.url),n.emit("artplayerPluginAds:click",e)})}(),n.pause(),e.video?(n.proxy(m,"error",O),n.proxy(m,"loadedmetadata",()=>{A(),m.play(),g(v,"display","flex"),g(b,"display","flex"),g(w,"display","none")})):(A(),g(v,"display","flex"),g(b,"display","flex"),g(w,"display","none")),n.proxy(document,"visibilitychange",()=>{document.hidden?_():A()}))}return n.on("ready",()=>{n.once("play",T),n.once("video:playing",T)}),{name:"arLine truncated
|
||||
//# sourceMappingURL=artplayer-plugin-ads.esm.js.map
|
||||
@@ -1 +1 @@
|
||||
{"mappings":"C,A,S,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,E,I,E,A,a,O,W,W,A,a,O,K,K,A,a,O,O,O,A,a,O,O,O,C,E,E,A,Y,O,C,C,E,E,C,C,E,C,E,E,C,E,C,E,E,E,K,E,C,E,E,A,a,O,Q,A,Y,O,O,O,E,O,O,C,I,C,Q,S,E,C,C,C,E,G,C,C,C,E,C,C,G,C,C,C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,qBACN,KAAA,EACA,MAAA,EACA,KAAA,CACF,CACF,CACF,CAEA,GAAI,AAAoB,aAApB,OAAO,UACL,CAAC,SAAS,cAAc,CAAC,wBAAyB,CACpD,IAAM,EAAS,SAAS,aAAa,CAAC,QACtC,CAAA,EAAO,EAAE,CAAG,uBACZ,EAAO,WAAW,CAAG,EAAA,OAAK,CAC1B,SAAS,IAAI,CAAC,WAAW,CAAC,EAC5B,CAGE,AAAkB,aAAlB,OAAO,QACT,CAAA,OAAO,kBAAkB,CAAG,CAD9B,C,E,C,2B,Q,iD,O,E,C,Q,C,S,C,C,C,C,C,C,C,ECvSA,EAAO,OAAO,CAAG,ypC,E,C,E,C,Q,C,S,C,C,C,C,C,C,C,ECAjB,EAAQ,cAAc,CAAG,SAAU,CAAC,ELine truncated
|
||||
@@ -5,4 +5,4 @@
|
||||
* (c) 2017-2025 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,n,l,t,i,a,r,o){var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},p="function"==typeof d[t]&&d[t],s=p.i||{},u=p.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function y(n,l){if(!u[n]){if(!e[n]){if(i[n])return i[n];var a="function"==typeof d[t]&&d[t];if(!l&&a)return a(n,!0);if(p)return p(n,!0);if(c&&"string"==typeof n)return c(n);var r=Error("Cannot find module '"+n+"'");throw r.code="MODULE_NOT_FOUND",r}s.resolve=function(l){var t=e[n][1][l];return null!=t?t:l},s.cache={};var o=u[n]=new y.Module(n);e[n][0].call(o.exports,s,o,o.exports,d)}return u[n].exports;function s(e){var n=s.resolve(e);return!1===n?{}:y(n)}}y.isParcelRequire=!0,y.Module=function(e){this.id=e,this.bundle=y,this.require=c,this.exports={}},y.modules=e,y.cache=u,y.parent=p,y.distDir=void 0,y.publicUrl=void 0,y.devServer=void 0,y.i=s,y.register=function(n,l){e[n]=[function(e,n){n.exports=l},{}]},Object.defineProperty(y,"root",{get:function(){return d[t]}}),d[t]=y;for(var f=0;f<n.length;f++)y(n[f]);if(l){var g=y(l);"object"==typeof exports&&"undefined"!=typeof module?module.exports=g:"function"==typeof define&&define.amd&&define(function(){return g})}}({jz4E5:[function(e,n,l,t){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(l),i.export(l,"default",()=>o);var a=e("bundle-text:./style.less"),r=i.interopDefault(a);function o(e){return n=>{let{version:l,utils:{errorHandle:t}}=n.constructor,i=l.split(".").map(Number);t(i[0]+i[1]/100>=5,`Artplayer.js@${l} is not compatible the artplayerPluginAds@${o.version}. Please update it to version Artplayer.js@5.x.x`);let{template:{$player:a},icons:{volume:r,volumeClose:d,fullscreenOn:p,fullscreenOff:s,loading:u},constructor:{validator:c,utils:{query:y,append:f,setStyle:g}}}=n;e=c({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 m=null,v=null,x=null,h=null,b=null,w=null,j=0,D=null,P=!1,$=!1,k=!1;function O(e,n){return n.replace("%s",e)}function A(){P=!0,n.play(),e.video&&m.pause(),g(n.template.$ads,"display","none"),n.emit("artplayerPluginAds:skip",e)}function M(){P||(D=setTimeout(()=>{j+=1;let n=e.playDuration-j;n>=1?x.innerHTML=O(n,e.i18n.canBeClosed):(x.innerHTML=e.i18n.close,k||(k=!0)),h.innerHTML=O(e.totalDuration-j,e.i18n.countdown),j>=e.totalDuration?A():M()},1e3))}function E(){P||clearTimeout(D)}function T(){$||($=!0,function(){n.template.$ads=f(a,'<div class="artplayer-plugin-ads"></div>'),m=f(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>`),w=f(n.template.$ads,'<div class="artplayer-plugin-ads-loading"></div>'),f(w,u),x=y(".artplayer-plugin-ads-close",v=f(n.template.$ads,`<div class="artplayer-plugin-ads-timer"><div class="artplayer-plugin-ads-close">${e.playDuration<=0?e.i18n.close:O(e.playDuration,e.i18n.canBeClosed)}</div><div class="artplayer-plugin-ads-countdown">${O(e.totalDuration,e.i18n.countdown)}</div></div>`)),h=y(".artplayer-plugin-ads-countdown",v),e.playDuration>=e.totalDuration&&g(x,"display","none"),n.proxy(x,"click",()=>{k&&A()});let l=y(".artplayer-plugin-ads-detail",b=f(n.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>`)),t=y(".artplayer-plugin-ads-muted",b),i=y(".artplayer-plugin-ads-fullscreen",b);if(e.url?n.proxy(l,"click",()=>{window.open(e.url),n.emit("artplayerPluginAds:click",e)}):g(l,"display","none"),e.video){let l=f(t,r),i=f(t,d);g(i,"display","none"),e.muted&&(m.muted=!0,g(l,"display","none"),g(i,"display","inline-flex")),n.proxy(t,"click",()=>{m.muted=!m.muted,m.muted?(g(l,"display","none"),g(i,"display","inline-flex")):(g(l,"display","inline-flex"),g(i,"display","none"))})}else g(t,"display","none");let o=f(i,p),c=f(i,s);g(c,"display","none"),n.proxy(i,"click",()=>{n.fullscreen=!n.fullscreen,n.fullscreen?(g(o,"display","inline-flex"),g(c,"display","none")):(g(o,"display","none"),g(c,"display","inline-flex"))}),n.proxy(m,"click",()=>{e.url&&window.open(e.url),n.emit("artplayerPluginAds:click",e)})}(),n.pause(),e.video?(n.proxy(m,"error",A),n.proxy(m,"loadedmetadata",()=>{M(),m.play(),g(v,"display","flex"),g(b,"display","flex"),g(w,"display","none")})):(M(),g(v,"display","flex"),g(b,"display","flex"),g(w,"display","none")),n.proxy(document,"visibilitychange",()=>{document.hidden?E():M()}))}return n.on("ready",()=>{n.once("play",T),n.once("video:playing",T)}),{name:"artpLine truncated
|
||||
!function(e,n,l,t,i,a,r,o){var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},p="function"==typeof d[t]&&d[t],s=p.i||{},u=p.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function y(n,l){if(!u[n]){if(!e[n]){if(i[n])return i[n];var a="function"==typeof d[t]&&d[t];if(!l&&a)return a(n,!0);if(p)return p(n,!0);if(c&&"string"==typeof n)return c(n);var r=Error("Cannot find module '"+n+"'");throw r.code="MODULE_NOT_FOUND",r}s.resolve=function(l){var t=e[n][1][l];return null!=t?t:l},s.cache={};var o=u[n]=new y.Module(n);e[n][0].call(o.exports,s,o,o.exports,d)}return u[n].exports;function s(e){var n=s.resolve(e);return!1===n?{}:y(n)}}y.isParcelRequire=!0,y.Module=function(e){this.id=e,this.bundle=y,this.require=c,this.exports={}},y.modules=e,y.cache=u,y.parent=p,y.distDir=void 0,y.publicUrl=void 0,y.devServer=void 0,y.i=s,y.register=function(n,l){e[n]=[function(e,n){n.exports=l},{}]},Object.defineProperty(y,"root",{get:function(){return d[t]}}),d[t]=y;for(var f=0;f<n.length;f++)y(n[f]);if(l){var g=y(l);"object"==typeof exports&&"undefined"!=typeof module?module.exports=g:"function"==typeof define&&define.amd&&define(function(){return g})}}({ezZng:[function(e,n,l,t){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(l),i.export(l,"default",()=>o);var a=e("bundle-text:./style.less"),r=i.interopDefault(a);function o(e){return n=>{let{version:l,utils:{errorHandle:t}}=n.constructor,i=l.split(".").map(Number);t(i[0]+i[1]/100>=5,`Artplayer.js@${l} is not compatible the artplayerPluginAds@${o.version}. Please update it to version Artplayer.js@5.x.x`);let{template:{$player:a},icons:{volume:r,volumeClose:d,fullscreenOn:p,fullscreenOff:s,loading:u},constructor:{validator:c,utils:{query:y,append:f,setStyle:g}}}=n;e=c({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 m=null,v=null,x=null,h=null,b=null,w=null,D=0,j=null,k=!1,P=!1,$=!1;function O(e,n){return n.replace("%s",e)}function A(){k=!0,n.play(),e.video&&m.pause(),g(n.template.$ads,"display","none"),n.emit("artplayerPluginAds:skip",e)}function M(){k||(j=setTimeout(()=>{D+=1;let n=e.playDuration-D;n>=1?x.innerHTML=O(n,e.i18n.canBeClosed):(x.innerHTML=e.i18n.close,$||($=!0)),h.innerHTML=O(e.totalDuration-D,e.i18n.countdown),D>=e.totalDuration?A():M()},1e3))}function T(){k||clearTimeout(j)}function _(){P||(P=!0,function(){n.template.$ads=f(a,'<div class="artplayer-plugin-ads"></div>'),m=f(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>`),w=f(n.template.$ads,'<div class="artplayer-plugin-ads-loading"></div>'),f(w,u),x=y(".artplayer-plugin-ads-close",v=f(n.template.$ads,`<div class="artplayer-plugin-ads-timer"><div class="artplayer-plugin-ads-close">${e.playDuration<=0?e.i18n.close:O(e.playDuration,e.i18n.canBeClosed)}</div><div class="artplayer-plugin-ads-countdown">${O(e.totalDuration,e.i18n.countdown)}</div></div>`)),h=y(".artplayer-plugin-ads-countdown",v),e.playDuration>=e.totalDuration&&g(x,"display","none"),n.proxy(x,"click",()=>{$&&A()});let l=y(".artplayer-plugin-ads-detail",b=f(n.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>`)),t=y(".artplayer-plugin-ads-muted",b),i=y(".artplayer-plugin-ads-fullscreen",b);if(e.url?n.proxy(l,"click",()=>{window.open(e.url),n.emit("artplayerPluginAds:click",e)}):g(l,"display","none"),e.video){let l=f(t,r),i=f(t,d);g(i,"display","none"),e.muted&&(m.muted=!0,g(l,"display","none"),g(i,"display","inline-flex")),n.proxy(t,"click",()=>{m.muted=!m.muted,m.muted?(g(l,"display","none"),g(i,"display","inline-flex")):(g(l,"display","inline-flex"),g(i,"display","none"))})}else g(t,"display","none");let o=f(i,p),c=f(i,s);g(c,"display","none"),n.proxy(i,"click",()=>{n.fullscreen=!n.fullscreen,n.fullscreen?(g(o,"display","inline-flex"),g(c,"display","none")):(g(o,"display","none"),g(c,"display","inline-flex"))}),n.proxy(m,"click",()=>{e.url&&window.open(e.url),n.emit("artplayerPluginAds:click",e)})}(),n.pause(),e.video?(n.proxy(m,"error",A),n.proxy(m,"loadedmetadata",()=>{M(),m.play(),g(v,"display","flex"),g(b,"display","flex"),g(w,"display","none")})):(M(),g(v,"display","flex"),g(b,"display","flex"),g(w,"display","none")),n.proxy(document,"visibilitychange",()=>{document.hidden?T():M()}))}return n.on("ready",()=>{n.once("play",_),n.once("video:playing",_)}),{name:"artpLine truncated
|
||||
@@ -5,4 +5,4 @@
|
||||
* (c) 2017-2025 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,n,t,i,l,r,a,o){var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof d[i]&&d[i],s=u.i||{},p=u.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(n,t){if(!p[n]){if(!e[n]){if(l[n])return l[n];var r="function"==typeof d[i]&&d[i];if(!t&&r)return r(n,!0);if(u)return u(n,!0);if(c&&"string"==typeof n)return c(n);var a=Error("Cannot find module '"+n+"'");throw a.code="MODULE_NOT_FOUND",a}s.resolve=function(t){var i=e[n][1][t];return null!=i?i:t},s.cache={};var o=p[n]=new f.Module(n);e[n][0].call(o.exports,s,o,o.exports,d)}return p[n].exports;function s(e){var n=s.resolve(e);return!1===n?{}:f(n)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=c,this.exports={}},f.modules=e,f.cache=p,f.parent=u,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=s,f.register=function(n,t){e[n]=[function(e,n){n.exports=t},{}]},Object.defineProperty(f,"root",{get:function(){return d[i]}}),d[i]=f;for(var y=0;y<n.length;y++)f(n[y]);if(t){var g=f(t);"object"==typeof exports&&"undefined"!=typeof module?module.exports=g:"function"==typeof define&&define.amd&&define(function(){return g})}}({bzF6W:[function(e,n,t,i){var l=e("@parcel/transformer-js/src/esmodule-helpers.js");l.defineInteropFlag(t),l.export(t,"default",function(){return d});var r=e("@swc/helpers/cjs/_object_spread.cjs"),a=e("bundle-text:./style.less"),o=l.interopDefault(a);function d(e){return function(n){i=(t=n.constructor).version,(0,t.utils.errorHandle)((l=i.split(".").map(Number))[0]+l[1]/100>=5,"Artplayer.js@".concat(i," is not compatible the artplayerPluginAds@").concat(d.version,". Please update it to version Artplayer.js@5.x.x"));var t,i,l,a=n.template.$player,o=n.icons,u=o.volume,s=o.volumeClose,p=o.fullscreenOn,c=o.fullscreenOff,f=o.loading,y=n.constructor,g=y.validator,m=y.utils,v=m.query,b=m.append,h=m.setStyle;e=g((0,r._)({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,D=null,P=null,_=0,k=null,A=!1,M=!1,q=!1;function C(e,n){return n.replace("%s",e)}function T(){A=!0,n.play(),e.video&&x.pause(),h(n.template.$ads,"display","none"),n.emit("artplayerPluginAds:skip",e)}function B(){A||(k=setTimeout(function(){_+=1;var n=e.playDuration-_;n>=1?j.innerHTML=C(n,e.i18n.canBeClosed):(j.innerHTML=e.i18n.close,q||(q=!0)),O.innerHTML=C(e.totalDuration-_,e.i18n.countdown),_>=e.totalDuration?T():B()},1e3))}function $(){A||clearTimeout(k)}function E(){M||(M=!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>")),P=b(n.template.$ads,'<div class="artplayer-plugin-ads-loading"></div>'),b(P,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:C(e.playDuration,e.i18n.canBeClosed),'</div>\n<div class="artplayer-plugin-ads-countdown">').concat(C(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(){q&&T()});var t=v(".artplayer-plugin-ads-detail",D=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>'))),i=v(".artplayer-plugin-ads-muted",D),l=v(".artplayer-plugin-ads-fullscreen",D);if(e.url?n.proxy(t,"click",function(){window.open(e.url),n.emit("artplayerPluginAds:click",e)}):h(t,"display","none"),e.video){var r=b(i,u),o=b(i,s);h(o,"display","none"),e.muted&&(x.muted=!0,h(r,"display","none"),h(o,"display","inline-flex")),n.proxy(i,"click",function(){x.muted=!x.muted,x.muted?(h(r,"display","none"),h(o,"display","inline-flex")):(h(r,"display","inline-flex"),h(o,"display","none"))})}else h(i,"display","none");var d=b(l,p),y=b(l,c);h(y,"display","none"),n.proxy(l,"click",function(){n.fullscreen=!n.fullscreen,n.fullscreen?(h(d,"display","inline-flex"),h(y,"display","none")):(h(d,"display","none"),h(y,"display","inline-flex"))}),n.proxy(x,"click",function(){e.url&&window.open(e.url),n.emit("artplayerPluginAds:click",e)})}(),n.pause(),e.video?(n.proxy(x,"error",T),n.proxy(x,"loadedmetadata",function(){B(),x.play(),h(w,"display","flex"),h(D,"display","flex"),h(P,"display","none")})):(B()Line truncated
|
||||
!function(e,n,t,l,i,r,a,o){var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof d[l]&&d[l],s=u.i||{},p=u.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(n,t){if(!p[n]){if(!e[n]){if(i[n])return i[n];var r="function"==typeof d[l]&&d[l];if(!t&&r)return r(n,!0);if(u)return u(n,!0);if(c&&"string"==typeof n)return c(n);var a=Error("Cannot find module '"+n+"'");throw a.code="MODULE_NOT_FOUND",a}s.resolve=function(t){var l=e[n][1][t];return null!=l?l:t},s.cache={};var o=p[n]=new f.Module(n);e[n][0].call(o.exports,s,o,o.exports,d)}return p[n].exports;function s(e){var n=s.resolve(e);return!1===n?{}:f(n)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=c,this.exports={}},f.modules=e,f.cache=p,f.parent=u,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=s,f.register=function(n,t){e[n]=[function(e,n){n.exports=t},{}]},Object.defineProperty(f,"root",{get:function(){return d[l]}}),d[l]=f;for(var y=0;y<n.length;y++)f(n[y]);if(t){var g=f(t);"object"==typeof exports&&"undefined"!=typeof module?module.exports=g:"function"==typeof define&&define.amd&&define(function(){return g})}}({"1qHWP":[function(e,n,t,l){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(t),i.export(t,"default",function(){return d});var r=e("@swc/helpers/cjs/_object_spread.cjs"),a=e("bundle-text:./style.less"),o=i.interopDefault(a);function d(e){return function(n){l=(t=n.constructor).version,(0,t.utils.errorHandle)((i=l.split(".").map(Number))[0]+i[1]/100>=5,"Artplayer.js@".concat(l," is not compatible the artplayerPluginAds@").concat(d.version,". Please update it to version Artplayer.js@5.x.x"));var t,l,i,a=n.template.$player,o=n.icons,u=o.volume,s=o.volumeClose,p=o.fullscreenOn,c=o.fullscreenOff,f=o.loading,y=n.constructor,g=y.validator,m=y.utils,v=m.query,b=m.append,x=m.setStyle;e=g((0,r._)({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 h=null,w=null,j=null,O=null,P=null,k=null,D=0,_=null,M=!1,q=!1,A=!1;function C(e,n){return n.replace("%s",e)}function E(){M=!0,n.play(),e.video&&h.pause(),x(n.template.$ads,"display","none"),n.emit("artplayerPluginAds:skip",e)}function T(){M||(_=setTimeout(function(){D+=1;var n=e.playDuration-D;n>=1?j.innerHTML=C(n,e.i18n.canBeClosed):(j.innerHTML=e.i18n.close,A||(A=!0)),O.innerHTML=C(e.totalDuration-D,e.i18n.countdown),D>=e.totalDuration?E():T()},1e3))}function H(){M||clearTimeout(_)}function $(){q||(q=!0,function(){n.template.$ads=b(a,'<div class="artplayer-plugin-ads"></div>'),h=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>")),k=b(n.template.$ads,'<div class="artplayer-plugin-ads-loading"></div>'),b(k,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:C(e.playDuration,e.i18n.canBeClosed),'</div>\n<div class="artplayer-plugin-ads-countdown">').concat(C(e.totalDuration,e.i18n.countdown),"</div>\n</div>"))),O=v(".artplayer-plugin-ads-countdown",w),e.playDuration>=e.totalDuration&&x(j,"display","none"),n.proxy(j,"click",function(){A&&E()});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>'))),l=v(".artplayer-plugin-ads-muted",P),i=v(".artplayer-plugin-ads-fullscreen",P);if(e.url?n.proxy(t,"click",function(){window.open(e.url),n.emit("artplayerPluginAds:click",e)}):x(t,"display","none"),e.video){var r=b(l,u),o=b(l,s);x(o,"display","none"),e.muted&&(h.muted=!0,x(r,"display","none"),x(o,"display","inline-flex")),n.proxy(l,"click",function(){h.muted=!h.muted,h.muted?(x(r,"display","none"),x(o,"display","inline-flex")):(x(r,"display","inline-flex"),x(o,"display","none"))})}else x(l,"display","none");var d=b(i,p),y=b(i,c);x(y,"display","none"),n.proxy(i,"click",function(){n.fullscreen=!n.fullscreen,n.fullscreen?(x(d,"display","inline-flex"),x(y,"display","none")):(x(d,"display","none"),x(y,"display","inline-flex"))}),n.proxy(h,"click",function(){e.url&&window.open(e.url),n.emit("artplayerPluginAds:click",e)})}(),n.pause(),e.video?(n.proxy(h,"error",E),n.proxy(h,"loadedmetadata",function(){T(),h.play(),x(w,"display","flex"),x(P,"display","flex"),x(k,"display","none")})):(TLine truncated
|
||||
@@ -1,30 +1,30 @@
|
||||
{
|
||||
"license": "MIT",
|
||||
"version": "2.0.0",
|
||||
"name": "artplayer-plugin-ads",
|
||||
"description": "Ads plugin for ArtPlayer",
|
||||
"main": "dist/artplayer-plugin-ads.js",
|
||||
"legacy": "dist/artplayer-plugin-ads.legacy.js",
|
||||
"module": "dist/artplayer-plugin-ads.esm.js",
|
||||
"types": "types/artplayer-plugin-ads.d.ts",
|
||||
"exports": {
|
||||
"import": "./dist/artplayer-plugin-ads.esm.js",
|
||||
"require": "./dist/artplayer-plugin-ads.js",
|
||||
"default": "./dist/artplayer-plugin-ads.js"
|
||||
},
|
||||
"author": "Harvey Zack <laozhaochaguan@gmail.com>",
|
||||
"browserslist": "last 1 Chrome version",
|
||||
"homepage": "https://artplayer.org",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/zhw2590582/ArtPlayer.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/zhw2590582/ArtPlayer/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"html5",
|
||||
"video",
|
||||
"player"
|
||||
]
|
||||
"name": "artplayer-plugin-ads",
|
||||
"version": "2.0.0",
|
||||
"description": "Ads plugin for ArtPlayer",
|
||||
"author": "Harvey Zack <laozhaochaguan@gmail.com>",
|
||||
"license": "MIT",
|
||||
"homepage": "https://artplayer.org",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/zhw2590582/ArtPlayer.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/zhw2590582/ArtPlayer/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"html5",
|
||||
"video",
|
||||
"player"
|
||||
],
|
||||
"exports": {
|
||||
"import": "./dist/artplayer-plugin-ads.esm.js",
|
||||
"require": "./dist/artplayer-plugin-ads.js",
|
||||
"default": "./dist/artplayer-plugin-ads.js"
|
||||
},
|
||||
"main": "dist/artplayer-plugin-ads.js",
|
||||
"legacy": "dist/artplayer-plugin-ads.legacy.js",
|
||||
"module": "dist/artplayer-plugin-ads.esm.js",
|
||||
"types": "types/artplayer-plugin-ads.d.ts",
|
||||
"browserslist": "last 1 Chrome version"
|
||||
}
|
||||
@@ -1,285 +1,298 @@
|
||||
import style from 'bundle-text:./style.less';
|
||||
import style from 'bundle-text:./style.less'
|
||||
|
||||
function checkVersion(art) {
|
||||
const {
|
||||
version,
|
||||
utils: { errorHandle },
|
||||
} = art.constructor;
|
||||
const arr = version.split('.').map(Number);
|
||||
const major = arr[0];
|
||||
const minor = arr[1] / 100;
|
||||
errorHandle(
|
||||
major + minor >= 5,
|
||||
`Artplayer.js@${version} is not compatible the artplayerPluginAds@${artplayerPluginAds.version}. Please update it to version Artplayer.js@5.x.x`,
|
||||
);
|
||||
const {
|
||||
version,
|
||||
utils: { errorHandle },
|
||||
} = art.constructor
|
||||
const arr = version.split('.').map(Number)
|
||||
const major = arr[0]
|
||||
const minor = arr[1] / 100
|
||||
errorHandle(
|
||||
major + minor >= 5,
|
||||
`Artplayer.js@${version} is not compatible the artplayerPluginAds@${artplayerPluginAds.version}. Please update it to version Artplayer.js@5.x.x`,
|
||||
)
|
||||
}
|
||||
|
||||
export default function artplayerPluginAds(option) {
|
||||
return (art) => {
|
||||
checkVersion(art);
|
||||
return (art) => {
|
||||
checkVersion(art)
|
||||
|
||||
const {
|
||||
template: { $player },
|
||||
icons: { volume, volumeClose, fullscreenOn, fullscreenOff, loading },
|
||||
constructor: {
|
||||
validator,
|
||||
utils: { query, append, setStyle },
|
||||
},
|
||||
} = art;
|
||||
const {
|
||||
template: { $player },
|
||||
icons: { volume, volumeClose, fullscreenOn, fullscreenOff, loading },
|
||||
constructor: {
|
||||
validator,
|
||||
utils: { query, append, setStyle },
|
||||
},
|
||||
} = art
|
||||
|
||||
option = validator(
|
||||
{
|
||||
html: '',
|
||||
video: '',
|
||||
url: '',
|
||||
playDuration: 5,
|
||||
totalDuration: 10,
|
||||
muted: false,
|
||||
i18n: {
|
||||
close: '关闭广告',
|
||||
countdown: '%s秒',
|
||||
detail: '查看详情',
|
||||
canBeClosed: '%s秒后可关闭广告',
|
||||
},
|
||||
...option,
|
||||
},
|
||||
{
|
||||
html: '?string',
|
||||
video: '?string',
|
||||
url: '?string',
|
||||
playDuration: 'number',
|
||||
totalDuration: 'number',
|
||||
muted: '?boolean',
|
||||
i18n: {
|
||||
close: 'string',
|
||||
countdown: 'string',
|
||||
detail: 'string',
|
||||
canBeClosed: 'string',
|
||||
},
|
||||
},
|
||||
);
|
||||
option = validator(
|
||||
{
|
||||
html: '',
|
||||
video: '',
|
||||
url: '',
|
||||
playDuration: 5,
|
||||
totalDuration: 10,
|
||||
muted: false,
|
||||
i18n: {
|
||||
close: '关闭广告',
|
||||
countdown: '%s秒',
|
||||
detail: '查看详情',
|
||||
canBeClosed: '%s秒后可关闭广告',
|
||||
},
|
||||
...option,
|
||||
},
|
||||
{
|
||||
html: '?string',
|
||||
video: '?string',
|
||||
url: '?string',
|
||||
playDuration: 'number',
|
||||
totalDuration: 'number',
|
||||
muted: '?boolean',
|
||||
i18n: {
|
||||
close: 'string',
|
||||
countdown: 'string',
|
||||
detail: 'string',
|
||||
canBeClosed: 'string',
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
let $ads = null;
|
||||
let $timer = null;
|
||||
let $close = null;
|
||||
let $countdown = null;
|
||||
let $control = null;
|
||||
let $loading = null;
|
||||
let $ads = null
|
||||
let $timer = null
|
||||
let $close = null
|
||||
let $countdown = null
|
||||
let $control = null
|
||||
let $loading = null
|
||||
|
||||
let time = 0;
|
||||
let timer = null;
|
||||
let isEnd = false;
|
||||
let isInit = false;
|
||||
let isCanClose = false;
|
||||
let time = 0
|
||||
let timer = null
|
||||
let isEnd = false
|
||||
let isInit = false
|
||||
let isCanClose = false
|
||||
|
||||
function getI18n(val, str) {
|
||||
return str.replace('%s', val);
|
||||
function getI18n(val, str) {
|
||||
return str.replace('%s', val)
|
||||
}
|
||||
|
||||
function skip() {
|
||||
isEnd = true
|
||||
art.play()
|
||||
if (option.video)
|
||||
$ads.pause()
|
||||
setStyle(art.template.$ads, 'display', 'none')
|
||||
art.emit('artplayerPluginAds:skip', option)
|
||||
}
|
||||
|
||||
function play() {
|
||||
if (isEnd)
|
||||
return
|
||||
|
||||
timer = setTimeout(() => {
|
||||
time += 1
|
||||
|
||||
const playDuration = option.playDuration - time
|
||||
if (playDuration >= 1) {
|
||||
$close.innerHTML = getI18n(playDuration, option.i18n.canBeClosed)
|
||||
}
|
||||
else {
|
||||
$close.innerHTML = option.i18n.close
|
||||
if (!isCanClose) {
|
||||
isCanClose = true
|
||||
}
|
||||
}
|
||||
|
||||
function skip() {
|
||||
isEnd = true;
|
||||
art.play();
|
||||
if (option.video) $ads.pause();
|
||||
setStyle(art.template.$ads, 'display', 'none');
|
||||
art.emit('artplayerPluginAds:skip', option);
|
||||
$countdown.innerHTML = getI18n(option.totalDuration - time, option.i18n.countdown)
|
||||
|
||||
if (time >= option.totalDuration) {
|
||||
skip()
|
||||
}
|
||||
|
||||
function play() {
|
||||
if (isEnd) return;
|
||||
|
||||
timer = setTimeout(() => {
|
||||
time += 1;
|
||||
|
||||
const playDuration = option.playDuration - time;
|
||||
if (playDuration >= 1) {
|
||||
$close.innerHTML = getI18n(playDuration, option.i18n.canBeClosed);
|
||||
} else {
|
||||
$close.innerHTML = option.i18n.close;
|
||||
if (!isCanClose) {
|
||||
isCanClose = true;
|
||||
}
|
||||
}
|
||||
|
||||
$countdown.innerHTML = getI18n(option.totalDuration - time, option.i18n.countdown);
|
||||
|
||||
if (time >= option.totalDuration) {
|
||||
skip();
|
||||
} else {
|
||||
play();
|
||||
}
|
||||
}, 1000);
|
||||
else {
|
||||
play()
|
||||
}
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
function pause() {
|
||||
if (isEnd) return;
|
||||
clearTimeout(timer);
|
||||
}
|
||||
function pause() {
|
||||
if (isEnd)
|
||||
return
|
||||
clearTimeout(timer)
|
||||
}
|
||||
|
||||
function show() {
|
||||
art.template.$ads = append($player, '<div class="artplayer-plugin-ads"></div>');
|
||||
function show() {
|
||||
art.template.$ads = append($player, '<div class="artplayer-plugin-ads"></div>')
|
||||
|
||||
$ads = append(
|
||||
art.template.$ads,
|
||||
option.video
|
||||
? `<video class="artplayer-plugin-ads-video" src="${option.video}" loop playsInline></video>`
|
||||
: `<div class="artplayer-plugin-ads-html">${option.html}</div>`,
|
||||
);
|
||||
$ads = append(
|
||||
art.template.$ads,
|
||||
option.video
|
||||
? `<video class="artplayer-plugin-ads-video" src="${option.video}" loop playsInline></video>`
|
||||
: `<div class="artplayer-plugin-ads-html">${option.html}</div>`,
|
||||
)
|
||||
|
||||
$loading = append(art.template.$ads, '<div class="artplayer-plugin-ads-loading"></div>');
|
||||
append($loading, loading);
|
||||
$loading = append(art.template.$ads, '<div class="artplayer-plugin-ads-loading"></div>')
|
||||
append($loading, loading)
|
||||
|
||||
$timer = append(
|
||||
art.template.$ads,
|
||||
`<div class="artplayer-plugin-ads-timer">
|
||||
$timer = append(
|
||||
art.template.$ads,
|
||||
`<div class="artplayer-plugin-ads-timer">
|
||||
<div class="artplayer-plugin-ads-close">${
|
||||
option.playDuration <= 0
|
||||
? option.i18n.close
|
||||
: getI18n(option.playDuration, option.i18n.canBeClosed)
|
||||
option.playDuration <= 0
|
||||
? option.i18n.close
|
||||
: getI18n(option.playDuration, option.i18n.canBeClosed)
|
||||
}</div>
|
||||
<div class="artplayer-plugin-ads-countdown">${getI18n(
|
||||
option.totalDuration,
|
||||
option.i18n.countdown,
|
||||
option.totalDuration,
|
||||
option.i18n.countdown,
|
||||
)}</div>
|
||||
</div>`,
|
||||
);
|
||||
)
|
||||
|
||||
$close = query('.artplayer-plugin-ads-close', $timer);
|
||||
$countdown = query('.artplayer-plugin-ads-countdown', $timer);
|
||||
$close = query('.artplayer-plugin-ads-close', $timer)
|
||||
$countdown = query('.artplayer-plugin-ads-countdown', $timer)
|
||||
|
||||
if (option.playDuration >= option.totalDuration) {
|
||||
setStyle($close, 'display', 'none');
|
||||
}
|
||||
if (option.playDuration >= option.totalDuration) {
|
||||
setStyle($close, 'display', 'none')
|
||||
}
|
||||
|
||||
art.proxy($close, 'click', () => {
|
||||
if (isCanClose) {
|
||||
skip();
|
||||
}
|
||||
});
|
||||
art.proxy($close, 'click', () => {
|
||||
if (isCanClose) {
|
||||
skip()
|
||||
}
|
||||
})
|
||||
|
||||
$control = append(
|
||||
art.template.$ads,
|
||||
`<div class="artplayer-plugin-ads-control">
|
||||
$control = append(
|
||||
art.template.$ads,
|
||||
`<div class="artplayer-plugin-ads-control">
|
||||
<div class="artplayer-plugin-ads-detail">${option.i18n.detail}</div>
|
||||
<div class="artplayer-plugin-ads-muted"></div>
|
||||
<div class="artplayer-plugin-ads-fullscreen"></div>
|
||||
</div>`,
|
||||
);
|
||||
)
|
||||
|
||||
const $detail = query('.artplayer-plugin-ads-detail', $control);
|
||||
const $muted = query('.artplayer-plugin-ads-muted', $control);
|
||||
const $fullscreen = query('.artplayer-plugin-ads-fullscreen', $control);
|
||||
const $detail = query('.artplayer-plugin-ads-detail', $control)
|
||||
const $muted = query('.artplayer-plugin-ads-muted', $control)
|
||||
const $fullscreen = query('.artplayer-plugin-ads-fullscreen', $control)
|
||||
|
||||
if (option.url) {
|
||||
art.proxy($detail, 'click', () => {
|
||||
window.open(option.url);
|
||||
art.emit('artplayerPluginAds:click', option);
|
||||
});
|
||||
} else {
|
||||
setStyle($detail, 'display', 'none');
|
||||
}
|
||||
if (option.url) {
|
||||
art.proxy($detail, 'click', () => {
|
||||
window.open(option.url)
|
||||
art.emit('artplayerPluginAds:click', option)
|
||||
})
|
||||
}
|
||||
else {
|
||||
setStyle($detail, 'display', 'none')
|
||||
}
|
||||
|
||||
if (option.video) {
|
||||
const $volume = append($muted, volume);
|
||||
const $volumeClose = append($muted, volumeClose);
|
||||
setStyle($volumeClose, 'display', 'none');
|
||||
if (option.video) {
|
||||
const $volume = append($muted, volume)
|
||||
const $volumeClose = append($muted, volumeClose)
|
||||
setStyle($volumeClose, 'display', 'none')
|
||||
|
||||
// If the ad was set to muted initially, match the icon
|
||||
if (option.muted) {
|
||||
$ads.muted = true;
|
||||
setStyle($volume, 'display', 'none');
|
||||
setStyle($volumeClose, 'display', 'inline-flex');
|
||||
}
|
||||
|
||||
art.proxy($muted, 'click', () => {
|
||||
$ads.muted = !$ads.muted;
|
||||
if ($ads.muted) {
|
||||
setStyle($volume, 'display', 'none');
|
||||
setStyle($volumeClose, 'display', 'inline-flex');
|
||||
} else {
|
||||
setStyle($volume, 'display', 'inline-flex');
|
||||
setStyle($volumeClose, 'display', 'none');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
setStyle($muted, 'display', 'none');
|
||||
}
|
||||
|
||||
const $fullscreenOn = append($fullscreen, fullscreenOn);
|
||||
const $fullscreenOff = append($fullscreen, fullscreenOff);
|
||||
setStyle($fullscreenOff, 'display', 'none');
|
||||
|
||||
art.proxy($fullscreen, 'click', () => {
|
||||
art.fullscreen = !art.fullscreen;
|
||||
if (art.fullscreen) {
|
||||
setStyle($fullscreenOn, 'display', 'inline-flex');
|
||||
setStyle($fullscreenOff, 'display', 'none');
|
||||
} else {
|
||||
setStyle($fullscreenOn, 'display', 'none');
|
||||
setStyle($fullscreenOff, 'display', 'inline-flex');
|
||||
}
|
||||
});
|
||||
|
||||
art.proxy($ads, 'click', () => {
|
||||
if (option.url) window.open(option.url);
|
||||
art.emit('artplayerPluginAds:click', option);
|
||||
});
|
||||
// If the ad was set to muted initially, match the icon
|
||||
if (option.muted) {
|
||||
$ads.muted = true
|
||||
setStyle($volume, 'display', 'none')
|
||||
setStyle($volumeClose, 'display', 'inline-flex')
|
||||
}
|
||||
|
||||
function init() {
|
||||
if (isInit) return;
|
||||
isInit = true;
|
||||
art.proxy($muted, 'click', () => {
|
||||
$ads.muted = !$ads.muted
|
||||
if ($ads.muted) {
|
||||
setStyle($volume, 'display', 'none')
|
||||
setStyle($volumeClose, 'display', 'inline-flex')
|
||||
}
|
||||
else {
|
||||
setStyle($volume, 'display', 'inline-flex')
|
||||
setStyle($volumeClose, 'display', 'none')
|
||||
}
|
||||
})
|
||||
}
|
||||
else {
|
||||
setStyle($muted, 'display', 'none')
|
||||
}
|
||||
|
||||
show();
|
||||
art.pause();
|
||||
const $fullscreenOn = append($fullscreen, fullscreenOn)
|
||||
const $fullscreenOff = append($fullscreen, fullscreenOff)
|
||||
setStyle($fullscreenOff, 'display', 'none')
|
||||
|
||||
if (option.video) {
|
||||
art.proxy($ads, 'error', skip);
|
||||
art.proxy($ads, 'loadedmetadata', () => {
|
||||
play();
|
||||
$ads.play();
|
||||
setStyle($timer, 'display', 'flex');
|
||||
setStyle($control, 'display', 'flex');
|
||||
setStyle($loading, 'display', 'none');
|
||||
});
|
||||
} else {
|
||||
play();
|
||||
setStyle($timer, 'display', 'flex');
|
||||
setStyle($control, 'display', 'flex');
|
||||
setStyle($loading, 'display', 'none');
|
||||
}
|
||||
|
||||
art.proxy(document, 'visibilitychange', () => {
|
||||
if (document.hidden) {
|
||||
pause();
|
||||
} else {
|
||||
play();
|
||||
}
|
||||
});
|
||||
art.proxy($fullscreen, 'click', () => {
|
||||
art.fullscreen = !art.fullscreen
|
||||
if (art.fullscreen) {
|
||||
setStyle($fullscreenOn, 'display', 'inline-flex')
|
||||
setStyle($fullscreenOff, 'display', 'none')
|
||||
}
|
||||
else {
|
||||
setStyle($fullscreenOn, 'display', 'none')
|
||||
setStyle($fullscreenOff, 'display', 'inline-flex')
|
||||
}
|
||||
})
|
||||
|
||||
art.on('ready', () => {
|
||||
art.once('play', init);
|
||||
art.once('video:playing', init);
|
||||
});
|
||||
art.proxy($ads, 'click', () => {
|
||||
if (option.url)
|
||||
window.open(option.url)
|
||||
art.emit('artplayerPluginAds:click', option)
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
name: 'artplayerPluginAds',
|
||||
skip,
|
||||
pause,
|
||||
play,
|
||||
};
|
||||
};
|
||||
function init() {
|
||||
if (isInit)
|
||||
return
|
||||
isInit = true
|
||||
|
||||
show()
|
||||
art.pause()
|
||||
|
||||
if (option.video) {
|
||||
art.proxy($ads, 'error', skip)
|
||||
art.proxy($ads, 'loadedmetadata', () => {
|
||||
play()
|
||||
$ads.play()
|
||||
setStyle($timer, 'display', 'flex')
|
||||
setStyle($control, 'display', 'flex')
|
||||
setStyle($loading, 'display', 'none')
|
||||
})
|
||||
}
|
||||
else {
|
||||
play()
|
||||
setStyle($timer, 'display', 'flex')
|
||||
setStyle($control, 'display', 'flex')
|
||||
setStyle($loading, 'display', 'none')
|
||||
}
|
||||
|
||||
art.proxy(document, 'visibilitychange', () => {
|
||||
if (document.hidden) {
|
||||
pause()
|
||||
}
|
||||
else {
|
||||
play()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
art.on('ready', () => {
|
||||
art.once('play', init)
|
||||
art.once('video:playing', init)
|
||||
})
|
||||
|
||||
return {
|
||||
name: 'artplayerPluginAds',
|
||||
skip,
|
||||
pause,
|
||||
play,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof document !== 'undefined') {
|
||||
if (!document.getElementById('artplayer-plugin-ads')) {
|
||||
const $style = document.createElement('style');
|
||||
$style.id = 'artplayer-plugin-ads';
|
||||
$style.textContent = style;
|
||||
document.head.appendChild($style);
|
||||
}
|
||||
if (!document.getElementById('artplayer-plugin-ads')) {
|
||||
const $style = document.createElement('style')
|
||||
$style.id = 'artplayer-plugin-ads'
|
||||
$style.textContent = style
|
||||
document.head.appendChild($style)
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
window['artplayerPluginAds'] = artplayerPluginAds;
|
||||
window.artplayerPluginAds = artplayerPluginAds
|
||||
}
|
||||
+40
-40
@@ -1,52 +1,52 @@
|
||||
import type Artplayer from 'artplayer';
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
export = artplayerPluginAds;
|
||||
export = artplayerPluginAds
|
||||
export as namespace artplayerPluginAds;
|
||||
|
||||
type Option = {
|
||||
/**
|
||||
* 广告源文本,支持视频链接、图片链接、HTML文本
|
||||
*/
|
||||
source: string;
|
||||
interface Option {
|
||||
/**
|
||||
* 广告源文本,支持视频链接、图片链接、HTML文本
|
||||
*/
|
||||
source: string
|
||||
|
||||
/**
|
||||
* 知名广告的类型:'video' | 'image' | 'html'
|
||||
*/
|
||||
type: 'video' | 'image' | 'html';
|
||||
/**
|
||||
* 知名广告的类型:'video' | 'image' | 'html'
|
||||
*/
|
||||
type: 'video' | 'image' | 'html'
|
||||
|
||||
/**
|
||||
* 广告必看的时长,单位为秒
|
||||
*/
|
||||
playDuration?: number;
|
||||
/**
|
||||
* 广告必看的时长,单位为秒
|
||||
*/
|
||||
playDuration?: number
|
||||
|
||||
/**
|
||||
* 广告总的时长,单位为秒
|
||||
*/
|
||||
totalDuration?: number;
|
||||
/**
|
||||
* 广告总的时长,单位为秒
|
||||
*/
|
||||
totalDuration?: number
|
||||
|
||||
/**
|
||||
* 视频广告是否默认静音
|
||||
*/
|
||||
muted?: boolean;
|
||||
};
|
||||
/**
|
||||
* 视频广告是否默认静音
|
||||
*/
|
||||
muted?: boolean
|
||||
}
|
||||
|
||||
type Ads = {
|
||||
name: 'artplayerPluginAds';
|
||||
interface Ads {
|
||||
name: 'artplayerPluginAds'
|
||||
|
||||
/**
|
||||
* 跳过广告
|
||||
*/
|
||||
skip: () => void;
|
||||
/**
|
||||
* 跳过广告
|
||||
*/
|
||||
skip: () => void
|
||||
|
||||
/**
|
||||
* 暂停广告
|
||||
*/
|
||||
pause: () => void;
|
||||
/**
|
||||
* 暂停广告
|
||||
*/
|
||||
pause: () => void
|
||||
|
||||
/**
|
||||
* 播放广告
|
||||
*/
|
||||
play: () => void;
|
||||
};
|
||||
/**
|
||||
* 播放广告
|
||||
*/
|
||||
play: () => void
|
||||
}
|
||||
|
||||
declare const artplayerPluginAds: (option: Option) => (art: Artplayer) => Ads;
|
||||
declare const artplayerPluginAds: (option: Option) => (art: Artplayer) => Ads
|
||||
Reference in new issue
Block a user