* Update artplayer.d.ts
This commit is contained in:
Harvey Zack authored and GitHub committed 2022-10-09 15:43:32 +08:00
1 parent e4196f53d9
commit 02953257f7
27 files changed
+1544 -1254

No files matched your search

+549 -410
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -4,4 +4,4 @@
* (c) 2017-2022 Harvey Zack
* Released under the MIT License.
*/
!function(e,n,l,t,i){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},r="function"==typeof a.parcelRequirea5da&&a.parcelRequirea5da,o=r.cache||{},d="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(n,l){if(!o[n]){if(!e[n]){var t="function"==typeof a.parcelRequirea5da&&a.parcelRequirea5da;if(!l&&t)return t(n,!0);if(r)return r(n,!0);if(d&&"string"==typeof n)return d(n);var i=new Error("Cannot find module '"+n+"'");throw i.code="MODULE_NOT_FOUND",i}u.resolve=function(l){var t=e[n][1][l];return null!=t?t:l},u.cache={};var s=o[n]=new p.Module(n);e[n][0].call(s.exports,u,s,s.exports,this)}return o[n].exports;function u(e){var n=u.resolve(e);return!1===n?{}:p(n)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.exports={}},p.modules=e,p.cache=o,p.parent=r,p.register=function(n,l){e[n]=[function(e,n){n.exports=l},{}]},Object.defineProperty(p,"root",{get:function(){return a.parcelRequirea5da}}),a.parcelRequirea5da=p;for(var s=0;s<n.length;s++)p(n[s]);var u=p(l);"object"==typeof exports&&"undefined"!=typeof module?module.exports=u:"function"==typeof define&&define.amd&&define((function(){return u}))}({E13ST:[function(e,n,l){var t=e("@parcel/transformer-js/src/esmodule-helpers.js");t.defineInteropFlag(l);var i=e("bundle-text:./style.less"),a=t.interopDefault(i);function r(e){return n=>{const{template:{$player:l},icons:{volume:t,volumeClose:i,fullscreenOn:a,fullscreenOff:r,loading:o},constructor:{validator:d,utils:{query:p,append:s,setStyle:u}}}=n;e=d({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 c=null,y=null,f=null,g=null,m=null,v=null,x=0,h=null,b=!1,w=!1,D=!1;function j(e,n){return n.replace("%s",e)}function k(){b=!0,n.play(),e.video&&c.pause(),u(n.template.$ads,"display","none"),n.emit("artplayerPluginAds:skip",e)}function O(){b||(h=setTimeout((()=>{x+=1;const n=e.playDuration-x;n>=1?f.innerHTML=j(n,e.i18n.canBeClosed):(f.innerHTML=e.i18n.close,D||(D=!0)),g.innerHTML=j(e.totalDuration-x,e.i18n.countdown),x>=e.totalDuration?k():O()}),1e3))}function $(){b||clearTimeout(h)}function P(){w||(w=!0,function(){n.template.$ads=s(l,'<div class="artplayer-plugin-ads"></div>'),c=s(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>`),v=s(n.template.$ads,'<div class="artplayer-plugin-ads-loading"></div>'),s(v,o),y=s(n.template.$ads,`<div class="artplayer-plugin-ads-timer"><div class="artplayer-plugin-ads-close">${e.playDuration<=0?e.i18n.close:j(e.playDuration,e.i18n.canBeClosed)}</div><div class="artplayer-plugin-ads-countdown">${j(e.totalDuration,e.i18n.countdown)}</div></div>`),f=p(".artplayer-plugin-ads-close",y),g=p(".artplayer-plugin-ads-countdown",y),e.playDuration>=e.totalDuration&&u(f,"display","none"),n.proxy(f,"click",(()=>{D&&k()})),m=s(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>`);const d=p(".artplayer-plugin-ads-detail",m),x=p(".artplayer-plugin-ads-muted",m),h=p(".artplayer-plugin-ads-fullscreen",m);if(e.url?n.proxy(d,"click",(()=>{window.open(e.url),n.emit("artplayerPluginAds:click",e)})):u(d,"display","none"),e.video){const l=s(x,t),a=s(x,i);u(a,"display","none"),e.muted&&(c.muted=!0,u(l,"display","none"),u(a,"display","inline-flex")),n.proxy(x,"click",(()=>{c.muted=!c.muted,c.muted?(u(l,"display","none"),u(a,"display","inline-flex")):(u(l,"display","inline-flex"),u(a,"display","none"))}))}else u(x,"display","none");const b=s(h,a),w=s(h,r);u(w,"display","none"),n.proxy(h,"click",(()=>{n.fullscreen=!n.fullscreen,n.fullscreen?(u(b,"display","inline-flex"),u(w,"display","none")):(u(b,"display","none"),u(w,"display","inline-flex"))})),n.proxy(c,"click",(()=>{e.url&&window.open(e.url),n.emit("artplayerPluginAds:click",e)}))}(),n.pause(),e.video?(n.proxy(c,"error",k),n.proxy(c,"loadedmetadata",(()=>{O(),c.play(),u(y,"display","flex"),u(m,"display","flex"),u(v,"display","none")}))):(O(),u(y,"display","flex"),u(m,"display","flex"),u(v,"display","none")),n.proxy(document,"visibilitychange",(()=>{document.hidden?$():O()})))}return n.on("ready",(()=>{n.once("play",P),n.once("video:playing",P)})),{name:"artplayerPluginAds",skip:k,pause:$,play:O}}}if(l.default=r,r.env="production",r.version="1.0.6",r.build="2022-10-08 09:50:34","undefined"!=typeof document&&!document.getElementById("artplayer-plugin-ads")){const e=document.createElement("stylLine truncated
!function(e,n,l,t,i){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},r="function"==typeof a.parcelRequirea5da&&a.parcelRequirea5da,o=r.cache||{},d="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(n,l){if(!o[n]){if(!e[n]){var t="function"==typeof a.parcelRequirea5da&&a.parcelRequirea5da;if(!l&&t)return t(n,!0);if(r)return r(n,!0);if(d&&"string"==typeof n)return d(n);var i=new Error("Cannot find module '"+n+"'");throw i.code="MODULE_NOT_FOUND",i}u.resolve=function(l){var t=e[n][1][l];return null!=t?t:l},u.cache={};var s=o[n]=new p.Module(n);e[n][0].call(s.exports,u,s,s.exports,this)}return o[n].exports;function u(e){var n=u.resolve(e);return!1===n?{}:p(n)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.exports={}},p.modules=e,p.cache=o,p.parent=r,p.register=function(n,l){e[n]=[function(e,n){n.exports=l},{}]},Object.defineProperty(p,"root",{get:function(){return a.parcelRequirea5da}}),a.parcelRequirea5da=p;for(var s=0;s<n.length;s++)p(n[s]);var u=p(l);"object"==typeof exports&&"undefined"!=typeof module?module.exports=u:"function"==typeof define&&define.amd&&define((function(){return u}))}({E13ST:[function(e,n,l){var t=e("@parcel/transformer-js/src/esmodule-helpers.js");t.defineInteropFlag(l);var i=e("bundle-text:./style.less"),a=t.interopDefault(i);function r(e){return n=>{const{template:{$player:l},icons:{volume:t,volumeClose:i,fullscreenOn:a,fullscreenOff:r,loading:o},constructor:{validator:d,utils:{query:p,append:s,setStyle:u}}}=n;e=d({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 c=null,y=null,f=null,g=null,m=null,v=null,x=0,h=null,b=!1,w=!1,D=!1;function j(e,n){return n.replace("%s",e)}function k(){b=!0,n.play(),e.video&&c.pause(),u(n.template.$ads,"display","none"),n.emit("artplayerPluginAds:skip",e)}function O(){b||(h=setTimeout((()=>{x+=1;const n=e.playDuration-x;n>=1?f.innerHTML=j(n,e.i18n.canBeClosed):(f.innerHTML=e.i18n.close,D||(D=!0)),g.innerHTML=j(e.totalDuration-x,e.i18n.countdown),x>=e.totalDuration?k():O()}),1e3))}function $(){b||clearTimeout(h)}function P(){w||(w=!0,function(){n.template.$ads=s(l,'<div class="artplayer-plugin-ads"></div>'),c=s(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>`),v=s(n.template.$ads,'<div class="artplayer-plugin-ads-loading"></div>'),s(v,o),y=s(n.template.$ads,`<div class="artplayer-plugin-ads-timer"><div class="artplayer-plugin-ads-close">${e.playDuration<=0?e.i18n.close:j(e.playDuration,e.i18n.canBeClosed)}</div><div class="artplayer-plugin-ads-countdown">${j(e.totalDuration,e.i18n.countdown)}</div></div>`),f=p(".artplayer-plugin-ads-close",y),g=p(".artplayer-plugin-ads-countdown",y),e.playDuration>=e.totalDuration&&u(f,"display","none"),n.proxy(f,"click",(()=>{D&&k()})),m=s(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>`);const d=p(".artplayer-plugin-ads-detail",m),x=p(".artplayer-plugin-ads-muted",m),h=p(".artplayer-plugin-ads-fullscreen",m);if(e.url?n.proxy(d,"click",(()=>{window.open(e.url),n.emit("artplayerPluginAds:click",e)})):u(d,"display","none"),e.video){const l=s(x,t),a=s(x,i);u(a,"display","none"),e.muted&&(c.muted=!0,u(l,"display","none"),u(a,"display","inline-flex")),n.proxy(x,"click",(()=>{c.muted=!c.muted,c.muted?(u(l,"display","none"),u(a,"display","inline-flex")):(u(l,"display","inline-flex"),u(a,"display","none"))}))}else u(x,"display","none");const b=s(h,a),w=s(h,r);u(w,"display","none"),n.proxy(h,"click",(()=>{n.fullscreen=!n.fullscreen,n.fullscreen?(u(b,"display","inline-flex"),u(w,"display","none")):(u(b,"display","none"),u(w,"display","inline-flex"))})),n.proxy(c,"click",(()=>{e.url&&window.open(e.url),n.emit("artplayerPluginAds:click",e)}))}(),n.pause(),e.video?(n.proxy(c,"error",k),n.proxy(c,"loadedmetadata",(()=>{O(),c.play(),u(y,"display","flex"),u(m,"display","flex"),u(v,"display","none")}))):(O(),u(y,"display","flex"),u(m,"display","flex"),u(v,"display","none")),n.proxy(document,"visibilitychange",(()=>{document.hidden?$():O()})))}return n.on("ready",(()=>{n.once("play",P),n.once("video:playing",P)})),{name:"artplayerPluginAds",skip:k,pause:$,play:O}}}if(l.default=r,r.env="production",r.version="1.0.6",r.build="2022-10-09 15:14:25","undefined"!=typeof document&&!document.getElementById("artplayer-plugin-ads")){const e=document.createElement("stylLine truncated
+1 -1
View File
@@ -4,4 +4,4 @@
* (c) 2017-2022 Harvey Zack
* Released under the MIT License.
*/
!function(t,e,n,i,r){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},o="function"==typeof a.parcelRequire93cf&&a.parcelRequire93cf,s=o.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(e,n){if(!s[e]){if(!t[e]){var i="function"==typeof a.parcelRequire93cf&&a.parcelRequire93cf;if(!n&&i)return i(e,!0);if(o)return o(e,!0);if(l&&"string"==typeof e)return l(e);var r=new Error("Cannot find module '"+e+"'");throw r.code="MODULE_NOT_FOUND",r}m.resolve=function(n){var i=t[e][1][n];return null!=i?i:n},m.cache={};var d=s[e]=new u.Module(e);t[e][0].call(d.exports,m,d,d.exports,this)}return s[e].exports;function m(t){var e=m.resolve(t);return!1===e?{}:u(e)}}u.isParcelRequire=!0,u.Module=function(t){this.id=t,this.bundle=u,this.exports={}},u.modules=t,u.cache=s,u.parent=o,u.register=function(e,n){t[e]=[function(t,e){e.exports=n},{}]},Object.defineProperty(u,"root",{get:function(){return a.parcelRequire93cf}}),a.parcelRequire93cf=u;for(var d=0;d<e.length;d++)u(e[d]);var m=u(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=m:"function"==typeof define&&define.amd&&define((function(){return m}))}({E13ST:[function(t,e,n){var i=t("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n);var r=t("./danmuku"),a=i.interopDefault(r),o=t("./setting"),s=i.interopDefault(o);function l(t){return e=>{!function(t){const{version:e,utils:{errorHandle:n}}=t.constructor,i=e.split(".").map(Number);n(i[0]+i[1]/100>=4.04,`Artplayer.js@${e} 不兼容该弹幕库,请更新到 4.4.x 版本以上`)}(e);const n=new(0,a.default)(e,t);return(0,s.default)(e,n),{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),get option(){return n.option},get isHide(){return n.isHide},get isStop(){return n.isStop}}}}n.default=l,l.env="production",l.version="4.4.10",l.build="2022-10-08 09:50:35","undefined"!=typeof window&&(window.artplayerPluginDanmuku=l)},{"./danmuku":"8Gtnh","./setting":"jAkJm","@parcel/transformer-js/src/esmodule-helpers.js":"9v6Cv"}],"8Gtnh":[function(t,e,n){var i=t("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n);var r=t("./bilibili"),a=t("./getDanmuTop"),o=i.interopDefault(a);class s{constructor(e,n){const{constructor:i,template:r}=e;if(this.utils=i.utils,this.validator=i.validator,this.$danmuku=r.$danmuku,this.$player=r.$player,this.art=e,this.queue=[],this.option={},this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.config(n),this.option.useWorker)try{this.worker=new Worker(t("27c3930ee158179a"))}catch(t){}this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.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("fullscreen",this.reset),e.on("fullscreenWeb",this.reset),e.on("destroy",this.destroy),this.load()}static get option(){return{danmuku:[],speed:5,margin:["2%","25%"],opacity:1,color:"#FFFFFF",mode:0,fontSize:25,filter:()=>!0,antiOverlap:!0,useWorker:!0,synchronousPlayback:!1,lockTime:5,maxLength:100,minWidth:200,maxWidth:400,mount:void 0,theme:"dark",beforeEmit:()=>!0}}static get scheme(){return{danmuku:"array|function|string",speed:"number",margin:"array",opacity:"number",color:"string",mode:"number",fontSize:"number|string",filter:"function",antiOverlap:"boolean",useWorker:"boolean",synchronousPlayback:"boolean",lockTime:"number",maxLength:"number",minWidth:"number",maxWidth:"number",mount:"undefined|htmldivelement",theme:"string",beforeEmit:"function"}}get isRotate(){return this.art.plugins.autoOrientation&&this.art.plugins.autoOrientation.state}get marginTop(){const{clamp:t}=this.utils,e=this.option.margin[0],{clientHeight:n}=this.$player;if("number"==typeof e)return t(e,0,n);if("string"==typeof e&&e.endsWith("%")){return t(n*(parseFloat(e)/100),0,n)}return s.option.margin[0]}get marginBottom(){const{clamp:t}=this.utils,e=this.option.margin[1],{clientHeight:n}=this.$player;if("number"==typeof e)return t(e,0,n);if("string"==typeof e&&e.endsWith("%")){return t(n*(parseFloat(e)/100),0,n)}return s.option.margin[1]}filter(t,e){return this.queue.filter((e=>e.$state===t)).map(e)}getLeft(t){const e=t.getBoundingClientRect();return this.isRotate?e.top:e.left}getRef(){const t=this.$refs.pop();if(t)return t;const e=document.createElement("div");return e.style.cssText='\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 visibility: hidden;\n font-family: SimHei, "Microsoft JhenLine truncated
!function(t,e,n,i,r){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},o="function"==typeof a.parcelRequire93cf&&a.parcelRequire93cf,s=o.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(e,n){if(!s[e]){if(!t[e]){var i="function"==typeof a.parcelRequire93cf&&a.parcelRequire93cf;if(!n&&i)return i(e,!0);if(o)return o(e,!0);if(l&&"string"==typeof e)return l(e);var r=new Error("Cannot find module '"+e+"'");throw r.code="MODULE_NOT_FOUND",r}m.resolve=function(n){var i=t[e][1][n];return null!=i?i:n},m.cache={};var d=s[e]=new u.Module(e);t[e][0].call(d.exports,m,d,d.exports,this)}return s[e].exports;function m(t){var e=m.resolve(t);return!1===e?{}:u(e)}}u.isParcelRequire=!0,u.Module=function(t){this.id=t,this.bundle=u,this.exports={}},u.modules=t,u.cache=s,u.parent=o,u.register=function(e,n){t[e]=[function(t,e){e.exports=n},{}]},Object.defineProperty(u,"root",{get:function(){return a.parcelRequire93cf}}),a.parcelRequire93cf=u;for(var d=0;d<e.length;d++)u(e[d]);var m=u(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=m:"function"==typeof define&&define.amd&&define((function(){return m}))}({E13ST:[function(t,e,n){var i=t("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n);var r=t("./danmuku"),a=i.interopDefault(r),o=t("./setting"),s=i.interopDefault(o);function l(t){return e=>{!function(t){const{version:e,utils:{errorHandle:n}}=t.constructor,i=e.split(".").map(Number);n(i[0]+i[1]/100>=4.04,`Artplayer.js@${e} 不兼容该弹幕库,请更新到 4.4.x 版本以上`)}(e);const n=new(0,a.default)(e,t);return(0,s.default)(e,n),{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),get option(){return n.option},get isHide(){return n.isHide},get isStop(){return n.isStop}}}}n.default=l,l.env="production",l.version="4.4.10",l.build="2022-10-09 15:14:27","undefined"!=typeof window&&(window.artplayerPluginDanmuku=l)},{"./danmuku":"8Gtnh","./setting":"jAkJm","@parcel/transformer-js/src/esmodule-helpers.js":"9v6Cv"}],"8Gtnh":[function(t,e,n){var i=t("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n);var r=t("./bilibili"),a=t("./getDanmuTop"),o=i.interopDefault(a);class s{constructor(e,n){const{constructor:i,template:r}=e;if(this.utils=i.utils,this.validator=i.validator,this.$danmuku=r.$danmuku,this.$player=r.$player,this.art=e,this.queue=[],this.option={},this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.config(n),this.option.useWorker)try{this.worker=new Worker(t("27c3930ee158179a"))}catch(t){}this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.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("fullscreen",this.reset),e.on("fullscreenWeb",this.reset),e.on("destroy",this.destroy),this.load()}static get option(){return{danmuku:[],speed:5,margin:["2%","25%"],opacity:1,color:"#FFFFFF",mode:0,fontSize:25,filter:()=>!0,antiOverlap:!0,useWorker:!0,synchronousPlayback:!1,lockTime:5,maxLength:100,minWidth:200,maxWidth:400,mount:void 0,theme:"dark",beforeEmit:()=>!0}}static get scheme(){return{danmuku:"array|function|string",speed:"number",margin:"array",opacity:"number",color:"string",mode:"number",fontSize:"number|string",filter:"function",antiOverlap:"boolean",useWorker:"boolean",synchronousPlayback:"boolean",lockTime:"number",maxLength:"number",minWidth:"number",maxWidth:"number",mount:"undefined|htmldivelement",theme:"string",beforeEmit:"function"}}get isRotate(){return this.art.plugins.autoOrientation&&this.art.plugins.autoOrientation.state}get marginTop(){const{clamp:t}=this.utils,e=this.option.margin[0],{clientHeight:n}=this.$player;if("number"==typeof e)return t(e,0,n);if("string"==typeof e&&e.endsWith("%")){return t(n*(parseFloat(e)/100),0,n)}return s.option.margin[0]}get marginBottom(){const{clamp:t}=this.utils,e=this.option.margin[1],{clientHeight:n}=this.$player;if("number"==typeof e)return t(e,0,n);if("string"==typeof e&&e.endsWith("%")){return t(n*(parseFloat(e)/100),0,n)}return s.option.margin[1]}filter(t,e){return this.queue.filter((e=>e.$state===t)).map(e)}getLeft(t){const e=t.getBoundingClientRect();return this.isRotate?e.top:e.left}getRef(){const t=this.$refs.pop();if(t)return t;const e=document.createElement("div");return e.style.cssText='\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 visibility: hidden;\n font-family: SimHei, "Microsoft JhenLine truncated
+1 -1
View File
@@ -4,4 +4,4 @@
* (c) 2017-2022 Harvey Zack
* Released under the MIT License.
*/
!function(e,t,r,o,i){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},n="function"==typeof a.parcelRequireb749&&a.parcelRequireb749,s=n.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,r){if(!s[t]){if(!e[t]){var o="function"==typeof a.parcelRequireb749&&a.parcelRequireb749;if(!r&&o)return o(t,!0);if(n)return n(t,!0);if(l&&"string"==typeof t)return l(t);var i=new Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}u.resolve=function(r){var o=e[t][1][r];return null!=o?o:r},u.cache={};var p=s[t]=new c.Module(t);e[t][0].call(p.exports,u,p,p.exports,this)}return s[t].exports;function u(e){var t=u.resolve(e);return!1===t?{}:c(t)}}c.isParcelRequire=!0,c.Module=function(e){this.id=e,this.bundle=c,this.exports={}},c.modules=e,c.cache=s,c.parent=n,c.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(c,"root",{get:function(){return a.parcelRequireb749}}),a.parcelRequireb749=c;for(var p=0;p<t.length;p++)c(t[p]);var u=c(r);"object"==typeof exports&&"undefined"!=typeof module?module.exports=u:"function"==typeof define&&define.amd&&define((function(){return u}))}({E13ST:[function(e,t,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r);var i=e("bundle-text:./style/index.less"),a=o.interopDefault(i),n=e("option-validator"),s=o.interopDefault(n),l=e("./utils/emitter"),c=o.interopDefault(l),p=e("./utils"),u=e("./scheme"),d=o.interopDefault(u),f=e("./config"),h=o.interopDefault(f),m=e("./whitelist"),g=o.interopDefault(m),v=e("./template"),y=o.interopDefault(v),b=e("./i18n"),x=o.interopDefault(b),w=e("./player"),j=o.interopDefault(w),k=e("./control"),S=o.interopDefault(k),I=e("./contextmenu"),C=o.interopDefault(I),F=e("./info"),$=o.interopDefault(F),M=e("./subtitle"),E=o.interopDefault(M),P=e("./events"),T=o.interopDefault(P),z=e("./hotkey"),D=o.interopDefault(z),A=e("./layer"),R=o.interopDefault(A),O=e("./loading"),L=o.interopDefault(O),N=e("./notice"),H=o.interopDefault(N),V=e("./mask"),Y=o.interopDefault(V),_=e("./icons"),q=o.interopDefault(_),W=e("./setting"),B=o.interopDefault(W),U=e("./storage"),Z=o.interopDefault(U),X=e("./plugins"),G=o.interopDefault(X),K=e("./mobile"),J=o.interopDefault(K);let Q=0;const ee=[];class te extends c.default{constructor(e,t){super(),this.id=++Q;const r=p.mergeDeep(te.option,e);if(this.option=(0,s.default)(r,d.default),this.isLock=!1,this.isReady=!1,this.isFocus=!1,this.isInput=!1,this.isRotate=!1,this.isDestroy=!1,this.whitelist=new(0,g.default)(this),this.template=new(0,y.default)(this),this.events=new(0,T.default)(this),this.whitelist.state?(this.storage=new(0,Z.default)(this),this.icons=new(0,q.default)(this),this.i18n=new(0,x.default)(this),this.notice=new(0,H.default)(this),this.player=new(0,j.default)(this),this.layers=new(0,R.default)(this),this.controls=new(0,S.default)(this),this.contextmenu=new(0,C.default)(this),this.subtitle=new(0,E.default)(this),this.info=new(0,$.default)(this),this.loading=new(0,L.default)(this),this.hotkey=new(0,D.default)(this),this.mask=new(0,Y.default)(this),this.setting=new(0,B.default)(this),this.plugins=new(0,G.default)(this)):this.mobile=new(0,J.default)(this),"function"==typeof t&&this.on("ready",(()=>t.call(this))),te.DEGUG){const e=e=>console.log(`[ART.${this.id}] -> ${e}`);e("Version@"+te.version),e("Env@"+te.env),e("Build@"+te.build);for(let t=0;t<h.default.events.length;t++)this.on("video:"+h.default.events[t],(t=>e("Event@"+t.type)))}ee.push(this)}static get instances(){return ee}static get version(){return"4.5.8"}static get env(){return"production"}static get build(){return"2022-10-08 09:50:31"}static get config(){return h.default}static get utils(){return p}static get scheme(){return d.default}static get Emitter(){return c.default}static get validator(){return s.default}static get kindOf(){return s.default.kindOf}static get html(){return y.default.html}static get option(){return{id:"",container:"#artplayer",url:"",poster:"",title:"",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,fastForward:!1,autoPlayback:!1,autoOrientation:!1,airplay:!1,layers:[],contextmenu:[],controls:[],settings:[],quality:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,column:10,width:0,height:0},subtitle:{url:"",type:"",style:{},encoding:"utf-8"},moreVideoAttr:{controls:!1,preload:p.isSafari?"auto":"metadata"},icons:{},customType:{},lang:navigator.language.toLowerCase()}}get proxy(){return this.events.proxy}get query(){return this.template.query}destroy(e=!0){this.events.destroy(),this.template.destroy(e),ee.splice(ee.indexOf(this),1),this.isDestroy=!0,this.eLine truncated
!function(e,t,r,o,i){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},n="function"==typeof a.parcelRequireb749&&a.parcelRequireb749,s=n.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,r){if(!s[t]){if(!e[t]){var o="function"==typeof a.parcelRequireb749&&a.parcelRequireb749;if(!r&&o)return o(t,!0);if(n)return n(t,!0);if(l&&"string"==typeof t)return l(t);var i=new Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}u.resolve=function(r){var o=e[t][1][r];return null!=o?o:r},u.cache={};var p=s[t]=new c.Module(t);e[t][0].call(p.exports,u,p,p.exports,this)}return s[t].exports;function u(e){var t=u.resolve(e);return!1===t?{}:c(t)}}c.isParcelRequire=!0,c.Module=function(e){this.id=e,this.bundle=c,this.exports={}},c.modules=e,c.cache=s,c.parent=n,c.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(c,"root",{get:function(){return a.parcelRequireb749}}),a.parcelRequireb749=c;for(var p=0;p<t.length;p++)c(t[p]);var u=c(r);"object"==typeof exports&&"undefined"!=typeof module?module.exports=u:"function"==typeof define&&define.amd&&define((function(){return u}))}({E13ST:[function(e,t,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r);var i=e("bundle-text:./style/index.less"),a=o.interopDefault(i),n=e("option-validator"),s=o.interopDefault(n),l=e("./utils/emitter"),c=o.interopDefault(l),p=e("./utils"),u=e("./scheme"),d=o.interopDefault(u),f=e("./config"),h=o.interopDefault(f),m=e("./whitelist"),g=o.interopDefault(m),v=e("./template"),y=o.interopDefault(v),b=e("./i18n"),x=o.interopDefault(b),w=e("./player"),j=o.interopDefault(w),k=e("./control"),S=o.interopDefault(k),I=e("./contextmenu"),C=o.interopDefault(I),F=e("./info"),$=o.interopDefault(F),M=e("./subtitle"),E=o.interopDefault(M),P=e("./events"),T=o.interopDefault(P),z=e("./hotkey"),D=o.interopDefault(z),A=e("./layer"),R=o.interopDefault(A),O=e("./loading"),L=o.interopDefault(O),N=e("./notice"),H=o.interopDefault(N),V=e("./mask"),Y=o.interopDefault(V),_=e("./icons"),q=o.interopDefault(_),W=e("./setting"),B=o.interopDefault(W),U=e("./storage"),Z=o.interopDefault(U),X=e("./plugins"),G=o.interopDefault(X),K=e("./mobile"),J=o.interopDefault(K);let Q=0;const ee=[];class te extends c.default{constructor(e,t){super(),this.id=++Q;const r=p.mergeDeep(te.option,e);if(this.option=(0,s.default)(r,d.default),this.isLock=!1,this.isReady=!1,this.isFocus=!1,this.isInput=!1,this.isRotate=!1,this.isDestroy=!1,this.whitelist=new(0,g.default)(this),this.template=new(0,y.default)(this),this.events=new(0,T.default)(this),this.whitelist.state?(this.storage=new(0,Z.default)(this),this.icons=new(0,q.default)(this),this.i18n=new(0,x.default)(this),this.notice=new(0,H.default)(this),this.player=new(0,j.default)(this),this.layers=new(0,R.default)(this),this.controls=new(0,S.default)(this),this.contextmenu=new(0,C.default)(this),this.subtitle=new(0,E.default)(this),this.info=new(0,$.default)(this),this.loading=new(0,L.default)(this),this.hotkey=new(0,D.default)(this),this.mask=new(0,Y.default)(this),this.setting=new(0,B.default)(this),this.plugins=new(0,G.default)(this)):this.mobile=new(0,J.default)(this),"function"==typeof t&&this.on("ready",(()=>t.call(this))),te.DEGUG){const e=e=>console.log(`[ART.${this.id}] -> ${e}`);e("Version@"+te.version),e("Env@"+te.env),e("Build@"+te.build);for(let t=0;t<h.default.events.length;t++)this.on("video:"+h.default.events[t],(t=>e("Event@"+t.type)))}ee.push(this)}static get instances(){return ee}static get version(){return"4.5.8"}static get env(){return"production"}static get build(){return"2022-10-09 15:14:22"}static get config(){return h.default}static get utils(){return p}static get scheme(){return d.default}static get Emitter(){return c.default}static get validator(){return s.default}static get kindOf(){return s.default.kindOf}static get html(){return y.default.html}static get option(){return{id:"",container:"#artplayer",url:"",poster:"",title:"",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,fastForward:!1,autoPlayback:!1,autoOrientation:!1,airplay:!1,layers:[],contextmenu:[],controls:[],settings:[],quality:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,column:10,width:0,height:0},subtitle:{url:"",type:"",style:{},encoding:"utf-8"},moreVideoAttr:{controls:!1,preload:p.isSafari?"auto":"metadata"},icons:{},customType:{},lang:navigator.language.toLowerCase()}}get proxy(){return this.events.proxy}get query(){return this.template.query}destroy(e=!0){this.events.destroy(),this.template.destroy(e),ee.splice(ee.indexOf(this),1),this.isDestroy=!0,this.eLine truncated
+1 -1
View File
@@ -248,7 +248,7 @@ class Artplayer extends (0, _emitterDefault.default) {
return "development";
}
static get build() {
return "2022-10-09 08:34:12";
return "2022-10-09 14:08:18";
}
static get config() {
return 0, _configDefault.default;
+3 -2
View File
@@ -4,10 +4,11 @@
"type": "module",
"description": "ArtPlayer.js is a modern and full featured HTML5 video player",
"scripts": {
"build:all": "npm run build all",
"build:all": "npm run build all && npm run build:sw && npm run build:ts",
"bootstrap": "npx lerna bootstrap --hoist",
"lint": "npx eslint packages/*/src",
"build:sw": "node ./scripts/build-sw.js",
"build:ts": "node ./scripts/build-ts.js",
"test:create": "node ./scripts/createTests.js",
"dev": "npx cross-env NODE_ENV=development node ./scripts/dev.js",
"build": "npx cross-env NODE_ENV=production node ./scripts/build.js",
@@ -57,4 +58,4 @@
"engines": {
"node": ">= 16.0.0"
}
}
}
+1 -1
View File
@@ -4,4 +4,4 @@
* (c) 2017-2022 Harvey Zack
* Released under the MIT License.
*/
!function(e,n,l,t,i){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},r="function"==typeof a.parcelRequirea5da&&a.parcelRequirea5da,o=r.cache||{},d="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(n,l){if(!o[n]){if(!e[n]){var t="function"==typeof a.parcelRequirea5da&&a.parcelRequirea5da;if(!l&&t)return t(n,!0);if(r)return r(n,!0);if(d&&"string"==typeof n)return d(n);var i=new Error("Cannot find module '"+n+"'");throw i.code="MODULE_NOT_FOUND",i}u.resolve=function(l){var t=e[n][1][l];return null!=t?t:l},u.cache={};var s=o[n]=new p.Module(n);e[n][0].call(s.exports,u,s,s.exports,this)}return o[n].exports;function u(e){var n=u.resolve(e);return!1===n?{}:p(n)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.exports={}},p.modules=e,p.cache=o,p.parent=r,p.register=function(n,l){e[n]=[function(e,n){n.exports=l},{}]},Object.defineProperty(p,"root",{get:function(){return a.parcelRequirea5da}}),a.parcelRequirea5da=p;for(var s=0;s<n.length;s++)p(n[s]);var u=p(l);"object"==typeof exports&&"undefined"!=typeof module?module.exports=u:"function"==typeof define&&define.amd&&define((function(){return u}))}({E13ST:[function(e,n,l){var t=e("@parcel/transformer-js/src/esmodule-helpers.js");t.defineInteropFlag(l);var i=e("bundle-text:./style.less"),a=t.interopDefault(i);function r(e){return n=>{const{template:{$player:l},icons:{volume:t,volumeClose:i,fullscreenOn:a,fullscreenOff:r,loading:o},constructor:{validator:d,utils:{query:p,append:s,setStyle:u}}}=n;e=d({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 c=null,y=null,f=null,g=null,m=null,v=null,x=0,h=null,b=!1,w=!1,D=!1;function j(e,n){return n.replace("%s",e)}function k(){b=!0,n.play(),e.video&&c.pause(),u(n.template.$ads,"display","none"),n.emit("artplayerPluginAds:skip",e)}function O(){b||(h=setTimeout((()=>{x+=1;const n=e.playDuration-x;n>=1?f.innerHTML=j(n,e.i18n.canBeClosed):(f.innerHTML=e.i18n.close,D||(D=!0)),g.innerHTML=j(e.totalDuration-x,e.i18n.countdown),x>=e.totalDuration?k():O()}),1e3))}function $(){b||clearTimeout(h)}function P(){w||(w=!0,function(){n.template.$ads=s(l,'<div class="artplayer-plugin-ads"></div>'),c=s(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>`),v=s(n.template.$ads,'<div class="artplayer-plugin-ads-loading"></div>'),s(v,o),y=s(n.template.$ads,`<div class="artplayer-plugin-ads-timer"><div class="artplayer-plugin-ads-close">${e.playDuration<=0?e.i18n.close:j(e.playDuration,e.i18n.canBeClosed)}</div><div class="artplayer-plugin-ads-countdown">${j(e.totalDuration,e.i18n.countdown)}</div></div>`),f=p(".artplayer-plugin-ads-close",y),g=p(".artplayer-plugin-ads-countdown",y),e.playDuration>=e.totalDuration&&u(f,"display","none"),n.proxy(f,"click",(()=>{D&&k()})),m=s(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>`);const d=p(".artplayer-plugin-ads-detail",m),x=p(".artplayer-plugin-ads-muted",m),h=p(".artplayer-plugin-ads-fullscreen",m);if(e.url?n.proxy(d,"click",(()=>{window.open(e.url),n.emit("artplayerPluginAds:click",e)})):u(d,"display","none"),e.video){const l=s(x,t),a=s(x,i);u(a,"display","none"),e.muted&&(c.muted=!0,u(l,"display","none"),u(a,"display","inline-flex")),n.proxy(x,"click",(()=>{c.muted=!c.muted,c.muted?(u(l,"display","none"),u(a,"display","inline-flex")):(u(l,"display","inline-flex"),u(a,"display","none"))}))}else u(x,"display","none");const b=s(h,a),w=s(h,r);u(w,"display","none"),n.proxy(h,"click",(()=>{n.fullscreen=!n.fullscreen,n.fullscreen?(u(b,"display","inline-flex"),u(w,"display","none")):(u(b,"display","none"),u(w,"display","inline-flex"))})),n.proxy(c,"click",(()=>{e.url&&window.open(e.url),n.emit("artplayerPluginAds:click",e)}))}(),n.pause(),e.video?(n.proxy(c,"error",k),n.proxy(c,"loadedmetadata",(()=>{O(),c.play(),u(y,"display","flex"),u(m,"display","flex"),u(v,"display","none")}))):(O(),u(y,"display","flex"),u(m,"display","flex"),u(v,"display","none")),n.proxy(document,"visibilitychange",(()=>{document.hidden?$():O()})))}return n.on("ready",(()=>{n.once("play",P),n.once("video:playing",P)})),{name:"artplayerPluginAds",skip:k,pause:$,play:O}}}if(l.default=r,r.env="production",r.version="1.0.6",r.build="2022-10-08 09:50:34","undefined"!=typeof document&&!document.getElementById("artplayer-plugin-ads")){const e=document.createElement("stylLine truncated
!function(e,n,l,t,i){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},r="function"==typeof a.parcelRequirea5da&&a.parcelRequirea5da,o=r.cache||{},d="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(n,l){if(!o[n]){if(!e[n]){var t="function"==typeof a.parcelRequirea5da&&a.parcelRequirea5da;if(!l&&t)return t(n,!0);if(r)return r(n,!0);if(d&&"string"==typeof n)return d(n);var i=new Error("Cannot find module '"+n+"'");throw i.code="MODULE_NOT_FOUND",i}u.resolve=function(l){var t=e[n][1][l];return null!=t?t:l},u.cache={};var s=o[n]=new p.Module(n);e[n][0].call(s.exports,u,s,s.exports,this)}return o[n].exports;function u(e){var n=u.resolve(e);return!1===n?{}:p(n)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.exports={}},p.modules=e,p.cache=o,p.parent=r,p.register=function(n,l){e[n]=[function(e,n){n.exports=l},{}]},Object.defineProperty(p,"root",{get:function(){return a.parcelRequirea5da}}),a.parcelRequirea5da=p;for(var s=0;s<n.length;s++)p(n[s]);var u=p(l);"object"==typeof exports&&"undefined"!=typeof module?module.exports=u:"function"==typeof define&&define.amd&&define((function(){return u}))}({E13ST:[function(e,n,l){var t=e("@parcel/transformer-js/src/esmodule-helpers.js");t.defineInteropFlag(l);var i=e("bundle-text:./style.less"),a=t.interopDefault(i);function r(e){return n=>{const{template:{$player:l},icons:{volume:t,volumeClose:i,fullscreenOn:a,fullscreenOff:r,loading:o},constructor:{validator:d,utils:{query:p,append:s,setStyle:u}}}=n;e=d({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 c=null,y=null,f=null,g=null,m=null,v=null,x=0,h=null,b=!1,w=!1,D=!1;function j(e,n){return n.replace("%s",e)}function k(){b=!0,n.play(),e.video&&c.pause(),u(n.template.$ads,"display","none"),n.emit("artplayerPluginAds:skip",e)}function O(){b||(h=setTimeout((()=>{x+=1;const n=e.playDuration-x;n>=1?f.innerHTML=j(n,e.i18n.canBeClosed):(f.innerHTML=e.i18n.close,D||(D=!0)),g.innerHTML=j(e.totalDuration-x,e.i18n.countdown),x>=e.totalDuration?k():O()}),1e3))}function $(){b||clearTimeout(h)}function P(){w||(w=!0,function(){n.template.$ads=s(l,'<div class="artplayer-plugin-ads"></div>'),c=s(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>`),v=s(n.template.$ads,'<div class="artplayer-plugin-ads-loading"></div>'),s(v,o),y=s(n.template.$ads,`<div class="artplayer-plugin-ads-timer"><div class="artplayer-plugin-ads-close">${e.playDuration<=0?e.i18n.close:j(e.playDuration,e.i18n.canBeClosed)}</div><div class="artplayer-plugin-ads-countdown">${j(e.totalDuration,e.i18n.countdown)}</div></div>`),f=p(".artplayer-plugin-ads-close",y),g=p(".artplayer-plugin-ads-countdown",y),e.playDuration>=e.totalDuration&&u(f,"display","none"),n.proxy(f,"click",(()=>{D&&k()})),m=s(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>`);const d=p(".artplayer-plugin-ads-detail",m),x=p(".artplayer-plugin-ads-muted",m),h=p(".artplayer-plugin-ads-fullscreen",m);if(e.url?n.proxy(d,"click",(()=>{window.open(e.url),n.emit("artplayerPluginAds:click",e)})):u(d,"display","none"),e.video){const l=s(x,t),a=s(x,i);u(a,"display","none"),e.muted&&(c.muted=!0,u(l,"display","none"),u(a,"display","inline-flex")),n.proxy(x,"click",(()=>{c.muted=!c.muted,c.muted?(u(l,"display","none"),u(a,"display","inline-flex")):(u(l,"display","inline-flex"),u(a,"display","none"))}))}else u(x,"display","none");const b=s(h,a),w=s(h,r);u(w,"display","none"),n.proxy(h,"click",(()=>{n.fullscreen=!n.fullscreen,n.fullscreen?(u(b,"display","inline-flex"),u(w,"display","none")):(u(b,"display","none"),u(w,"display","inline-flex"))})),n.proxy(c,"click",(()=>{e.url&&window.open(e.url),n.emit("artplayerPluginAds:click",e)}))}(),n.pause(),e.video?(n.proxy(c,"error",k),n.proxy(c,"loadedmetadata",(()=>{O(),c.play(),u(y,"display","flex"),u(m,"display","flex"),u(v,"display","none")}))):(O(),u(y,"display","flex"),u(m,"display","flex"),u(v,"display","none")),n.proxy(document,"visibilitychange",(()=>{document.hidden?$():O()})))}return n.on("ready",(()=>{n.once("play",P),n.once("video:playing",P)})),{name:"artplayerPluginAds",skip:k,pause:$,play:O}}}if(l.default=r,r.env="production",r.version="1.0.6",r.build="2022-10-09 15:14:25","undefined"!=typeof document&&!document.getElementById("artplayer-plugin-ads")){const e=document.createElement("stylLine truncated
@@ -4,4 +4,4 @@
* (c) 2017-2022 Harvey Zack
* Released under the MIT License.
*/
!function(t,e,n,i,r){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},o="function"==typeof a.parcelRequire93cf&&a.parcelRequire93cf,s=o.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(e,n){if(!s[e]){if(!t[e]){var i="function"==typeof a.parcelRequire93cf&&a.parcelRequire93cf;if(!n&&i)return i(e,!0);if(o)return o(e,!0);if(l&&"string"==typeof e)return l(e);var r=new Error("Cannot find module '"+e+"'");throw r.code="MODULE_NOT_FOUND",r}m.resolve=function(n){var i=t[e][1][n];return null!=i?i:n},m.cache={};var d=s[e]=new u.Module(e);t[e][0].call(d.exports,m,d,d.exports,this)}return s[e].exports;function m(t){var e=m.resolve(t);return!1===e?{}:u(e)}}u.isParcelRequire=!0,u.Module=function(t){this.id=t,this.bundle=u,this.exports={}},u.modules=t,u.cache=s,u.parent=o,u.register=function(e,n){t[e]=[function(t,e){e.exports=n},{}]},Object.defineProperty(u,"root",{get:function(){return a.parcelRequire93cf}}),a.parcelRequire93cf=u;for(var d=0;d<e.length;d++)u(e[d]);var m=u(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=m:"function"==typeof define&&define.amd&&define((function(){return m}))}({E13ST:[function(t,e,n){var i=t("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n);var r=t("./danmuku"),a=i.interopDefault(r),o=t("./setting"),s=i.interopDefault(o);function l(t){return e=>{!function(t){const{version:e,utils:{errorHandle:n}}=t.constructor,i=e.split(".").map(Number);n(i[0]+i[1]/100>=4.04,`Artplayer.js@${e} 不兼容该弹幕库,请更新到 4.4.x 版本以上`)}(e);const n=new(0,a.default)(e,t);return(0,s.default)(e,n),{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),get option(){return n.option},get isHide(){return n.isHide},get isStop(){return n.isStop}}}}n.default=l,l.env="production",l.version="4.4.10",l.build="2022-10-08 09:50:35","undefined"!=typeof window&&(window.artplayerPluginDanmuku=l)},{"./danmuku":"8Gtnh","./setting":"jAkJm","@parcel/transformer-js/src/esmodule-helpers.js":"9v6Cv"}],"8Gtnh":[function(t,e,n){var i=t("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n);var r=t("./bilibili"),a=t("./getDanmuTop"),o=i.interopDefault(a);class s{constructor(e,n){const{constructor:i,template:r}=e;if(this.utils=i.utils,this.validator=i.validator,this.$danmuku=r.$danmuku,this.$player=r.$player,this.art=e,this.queue=[],this.option={},this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.config(n),this.option.useWorker)try{this.worker=new Worker(t("27c3930ee158179a"))}catch(t){}this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.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("fullscreen",this.reset),e.on("fullscreenWeb",this.reset),e.on("destroy",this.destroy),this.load()}static get option(){return{danmuku:[],speed:5,margin:["2%","25%"],opacity:1,color:"#FFFFFF",mode:0,fontSize:25,filter:()=>!0,antiOverlap:!0,useWorker:!0,synchronousPlayback:!1,lockTime:5,maxLength:100,minWidth:200,maxWidth:400,mount:void 0,theme:"dark",beforeEmit:()=>!0}}static get scheme(){return{danmuku:"array|function|string",speed:"number",margin:"array",opacity:"number",color:"string",mode:"number",fontSize:"number|string",filter:"function",antiOverlap:"boolean",useWorker:"boolean",synchronousPlayback:"boolean",lockTime:"number",maxLength:"number",minWidth:"number",maxWidth:"number",mount:"undefined|htmldivelement",theme:"string",beforeEmit:"function"}}get isRotate(){return this.art.plugins.autoOrientation&&this.art.plugins.autoOrientation.state}get marginTop(){const{clamp:t}=this.utils,e=this.option.margin[0],{clientHeight:n}=this.$player;if("number"==typeof e)return t(e,0,n);if("string"==typeof e&&e.endsWith("%")){return t(n*(parseFloat(e)/100),0,n)}return s.option.margin[0]}get marginBottom(){const{clamp:t}=this.utils,e=this.option.margin[1],{clientHeight:n}=this.$player;if("number"==typeof e)return t(e,0,n);if("string"==typeof e&&e.endsWith("%")){return t(n*(parseFloat(e)/100),0,n)}return s.option.margin[1]}filter(t,e){return this.queue.filter((e=>e.$state===t)).map(e)}getLeft(t){const e=t.getBoundingClientRect();return this.isRotate?e.top:e.left}getRef(){const t=this.$refs.pop();if(t)return t;const e=document.createElement("div");return e.style.cssText='\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 visibility: hidden;\n font-family: SimHei, "Microsoft JhenLine truncated
!function(t,e,n,i,r){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},o="function"==typeof a.parcelRequire93cf&&a.parcelRequire93cf,s=o.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(e,n){if(!s[e]){if(!t[e]){var i="function"==typeof a.parcelRequire93cf&&a.parcelRequire93cf;if(!n&&i)return i(e,!0);if(o)return o(e,!0);if(l&&"string"==typeof e)return l(e);var r=new Error("Cannot find module '"+e+"'");throw r.code="MODULE_NOT_FOUND",r}m.resolve=function(n){var i=t[e][1][n];return null!=i?i:n},m.cache={};var d=s[e]=new u.Module(e);t[e][0].call(d.exports,m,d,d.exports,this)}return s[e].exports;function m(t){var e=m.resolve(t);return!1===e?{}:u(e)}}u.isParcelRequire=!0,u.Module=function(t){this.id=t,this.bundle=u,this.exports={}},u.modules=t,u.cache=s,u.parent=o,u.register=function(e,n){t[e]=[function(t,e){e.exports=n},{}]},Object.defineProperty(u,"root",{get:function(){return a.parcelRequire93cf}}),a.parcelRequire93cf=u;for(var d=0;d<e.length;d++)u(e[d]);var m=u(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=m:"function"==typeof define&&define.amd&&define((function(){return m}))}({E13ST:[function(t,e,n){var i=t("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n);var r=t("./danmuku"),a=i.interopDefault(r),o=t("./setting"),s=i.interopDefault(o);function l(t){return e=>{!function(t){const{version:e,utils:{errorHandle:n}}=t.constructor,i=e.split(".").map(Number);n(i[0]+i[1]/100>=4.04,`Artplayer.js@${e} 不兼容该弹幕库,请更新到 4.4.x 版本以上`)}(e);const n=new(0,a.default)(e,t);return(0,s.default)(e,n),{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),get option(){return n.option},get isHide(){return n.isHide},get isStop(){return n.isStop}}}}n.default=l,l.env="production",l.version="4.4.10",l.build="2022-10-09 15:14:27","undefined"!=typeof window&&(window.artplayerPluginDanmuku=l)},{"./danmuku":"8Gtnh","./setting":"jAkJm","@parcel/transformer-js/src/esmodule-helpers.js":"9v6Cv"}],"8Gtnh":[function(t,e,n){var i=t("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n);var r=t("./bilibili"),a=t("./getDanmuTop"),o=i.interopDefault(a);class s{constructor(e,n){const{constructor:i,template:r}=e;if(this.utils=i.utils,this.validator=i.validator,this.$danmuku=r.$danmuku,this.$player=r.$player,this.art=e,this.queue=[],this.option={},this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.config(n),this.option.useWorker)try{this.worker=new Worker(t("27c3930ee158179a"))}catch(t){}this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.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("fullscreen",this.reset),e.on("fullscreenWeb",this.reset),e.on("destroy",this.destroy),this.load()}static get option(){return{danmuku:[],speed:5,margin:["2%","25%"],opacity:1,color:"#FFFFFF",mode:0,fontSize:25,filter:()=>!0,antiOverlap:!0,useWorker:!0,synchronousPlayback:!1,lockTime:5,maxLength:100,minWidth:200,maxWidth:400,mount:void 0,theme:"dark",beforeEmit:()=>!0}}static get scheme(){return{danmuku:"array|function|string",speed:"number",margin:"array",opacity:"number",color:"string",mode:"number",fontSize:"number|string",filter:"function",antiOverlap:"boolean",useWorker:"boolean",synchronousPlayback:"boolean",lockTime:"number",maxLength:"number",minWidth:"number",maxWidth:"number",mount:"undefined|htmldivelement",theme:"string",beforeEmit:"function"}}get isRotate(){return this.art.plugins.autoOrientation&&this.art.plugins.autoOrientation.state}get marginTop(){const{clamp:t}=this.utils,e=this.option.margin[0],{clientHeight:n}=this.$player;if("number"==typeof e)return t(e,0,n);if("string"==typeof e&&e.endsWith("%")){return t(n*(parseFloat(e)/100),0,n)}return s.option.margin[0]}get marginBottom(){const{clamp:t}=this.utils,e=this.option.margin[1],{clientHeight:n}=this.$player;if("number"==typeof e)return t(e,0,n);if("string"==typeof e&&e.endsWith("%")){return t(n*(parseFloat(e)/100),0,n)}return s.option.margin[1]}filter(t,e){return this.queue.filter((e=>e.$state===t)).map(e)}getLeft(t){const e=t.getBoundingClientRect();return this.isRotate?e.top:e.left}getRef(){const t=this.$refs.pop();if(t)return t;const e=document.createElement("div");return e.style.cssText='\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 visibility: hidden;\n font-family: SimHei, "Microsoft JhenLine truncated
+1 -1
View File
@@ -4,4 +4,4 @@
* (c) 2017-2022 Harvey Zack
* Released under the MIT License.
*/
!function(e,t,r,o,i){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},n="function"==typeof a.parcelRequireb749&&a.parcelRequireb749,s=n.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,r){if(!s[t]){if(!e[t]){var o="function"==typeof a.parcelRequireb749&&a.parcelRequireb749;if(!r&&o)return o(t,!0);if(n)return n(t,!0);if(l&&"string"==typeof t)return l(t);var i=new Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}u.resolve=function(r){var o=e[t][1][r];return null!=o?o:r},u.cache={};var p=s[t]=new c.Module(t);e[t][0].call(p.exports,u,p,p.exports,this)}return s[t].exports;function u(e){var t=u.resolve(e);return!1===t?{}:c(t)}}c.isParcelRequire=!0,c.Module=function(e){this.id=e,this.bundle=c,this.exports={}},c.modules=e,c.cache=s,c.parent=n,c.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(c,"root",{get:function(){return a.parcelRequireb749}}),a.parcelRequireb749=c;for(var p=0;p<t.length;p++)c(t[p]);var u=c(r);"object"==typeof exports&&"undefined"!=typeof module?module.exports=u:"function"==typeof define&&define.amd&&define((function(){return u}))}({E13ST:[function(e,t,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r);var i=e("bundle-text:./style/index.less"),a=o.interopDefault(i),n=e("option-validator"),s=o.interopDefault(n),l=e("./utils/emitter"),c=o.interopDefault(l),p=e("./utils"),u=e("./scheme"),d=o.interopDefault(u),f=e("./config"),h=o.interopDefault(f),m=e("./whitelist"),g=o.interopDefault(m),v=e("./template"),y=o.interopDefault(v),b=e("./i18n"),x=o.interopDefault(b),w=e("./player"),j=o.interopDefault(w),k=e("./control"),S=o.interopDefault(k),I=e("./contextmenu"),C=o.interopDefault(I),F=e("./info"),$=o.interopDefault(F),M=e("./subtitle"),E=o.interopDefault(M),P=e("./events"),T=o.interopDefault(P),z=e("./hotkey"),D=o.interopDefault(z),A=e("./layer"),R=o.interopDefault(A),O=e("./loading"),L=o.interopDefault(O),N=e("./notice"),H=o.interopDefault(N),V=e("./mask"),Y=o.interopDefault(V),_=e("./icons"),q=o.interopDefault(_),W=e("./setting"),B=o.interopDefault(W),U=e("./storage"),Z=o.interopDefault(U),X=e("./plugins"),G=o.interopDefault(X),K=e("./mobile"),J=o.interopDefault(K);let Q=0;const ee=[];class te extends c.default{constructor(e,t){super(),this.id=++Q;const r=p.mergeDeep(te.option,e);if(this.option=(0,s.default)(r,d.default),this.isLock=!1,this.isReady=!1,this.isFocus=!1,this.isInput=!1,this.isRotate=!1,this.isDestroy=!1,this.whitelist=new(0,g.default)(this),this.template=new(0,y.default)(this),this.events=new(0,T.default)(this),this.whitelist.state?(this.storage=new(0,Z.default)(this),this.icons=new(0,q.default)(this),this.i18n=new(0,x.default)(this),this.notice=new(0,H.default)(this),this.player=new(0,j.default)(this),this.layers=new(0,R.default)(this),this.controls=new(0,S.default)(this),this.contextmenu=new(0,C.default)(this),this.subtitle=new(0,E.default)(this),this.info=new(0,$.default)(this),this.loading=new(0,L.default)(this),this.hotkey=new(0,D.default)(this),this.mask=new(0,Y.default)(this),this.setting=new(0,B.default)(this),this.plugins=new(0,G.default)(this)):this.mobile=new(0,J.default)(this),"function"==typeof t&&this.on("ready",(()=>t.call(this))),te.DEGUG){const e=e=>console.log(`[ART.${this.id}] -> ${e}`);e("Version@"+te.version),e("Env@"+te.env),e("Build@"+te.build);for(let t=0;t<h.default.events.length;t++)this.on("video:"+h.default.events[t],(t=>e("Event@"+t.type)))}ee.push(this)}static get instances(){return ee}static get version(){return"4.5.8"}static get env(){return"production"}static get build(){return"2022-10-08 09:50:31"}static get config(){return h.default}static get utils(){return p}static get scheme(){return d.default}static get Emitter(){return c.default}static get validator(){return s.default}static get kindOf(){return s.default.kindOf}static get html(){return y.default.html}static get option(){return{id:"",container:"#artplayer",url:"",poster:"",title:"",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,fastForward:!1,autoPlayback:!1,autoOrientation:!1,airplay:!1,layers:[],contextmenu:[],controls:[],settings:[],quality:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,column:10,width:0,height:0},subtitle:{url:"",type:"",style:{},encoding:"utf-8"},moreVideoAttr:{controls:!1,preload:p.isSafari?"auto":"metadata"},icons:{},customType:{},lang:navigator.language.toLowerCase()}}get proxy(){return this.events.proxy}get query(){return this.template.query}destroy(e=!0){this.events.destroy(),this.template.destroy(e),ee.splice(ee.indexOf(this),1),this.isDestroy=!0,this.eLine truncated
!function(e,t,r,o,i){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},n="function"==typeof a.parcelRequireb749&&a.parcelRequireb749,s=n.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,r){if(!s[t]){if(!e[t]){var o="function"==typeof a.parcelRequireb749&&a.parcelRequireb749;if(!r&&o)return o(t,!0);if(n)return n(t,!0);if(l&&"string"==typeof t)return l(t);var i=new Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}u.resolve=function(r){var o=e[t][1][r];return null!=o?o:r},u.cache={};var p=s[t]=new c.Module(t);e[t][0].call(p.exports,u,p,p.exports,this)}return s[t].exports;function u(e){var t=u.resolve(e);return!1===t?{}:c(t)}}c.isParcelRequire=!0,c.Module=function(e){this.id=e,this.bundle=c,this.exports={}},c.modules=e,c.cache=s,c.parent=n,c.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(c,"root",{get:function(){return a.parcelRequireb749}}),a.parcelRequireb749=c;for(var p=0;p<t.length;p++)c(t[p]);var u=c(r);"object"==typeof exports&&"undefined"!=typeof module?module.exports=u:"function"==typeof define&&define.amd&&define((function(){return u}))}({E13ST:[function(e,t,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r);var i=e("bundle-text:./style/index.less"),a=o.interopDefault(i),n=e("option-validator"),s=o.interopDefault(n),l=e("./utils/emitter"),c=o.interopDefault(l),p=e("./utils"),u=e("./scheme"),d=o.interopDefault(u),f=e("./config"),h=o.interopDefault(f),m=e("./whitelist"),g=o.interopDefault(m),v=e("./template"),y=o.interopDefault(v),b=e("./i18n"),x=o.interopDefault(b),w=e("./player"),j=o.interopDefault(w),k=e("./control"),S=o.interopDefault(k),I=e("./contextmenu"),C=o.interopDefault(I),F=e("./info"),$=o.interopDefault(F),M=e("./subtitle"),E=o.interopDefault(M),P=e("./events"),T=o.interopDefault(P),z=e("./hotkey"),D=o.interopDefault(z),A=e("./layer"),R=o.interopDefault(A),O=e("./loading"),L=o.interopDefault(O),N=e("./notice"),H=o.interopDefault(N),V=e("./mask"),Y=o.interopDefault(V),_=e("./icons"),q=o.interopDefault(_),W=e("./setting"),B=o.interopDefault(W),U=e("./storage"),Z=o.interopDefault(U),X=e("./plugins"),G=o.interopDefault(X),K=e("./mobile"),J=o.interopDefault(K);let Q=0;const ee=[];class te extends c.default{constructor(e,t){super(),this.id=++Q;const r=p.mergeDeep(te.option,e);if(this.option=(0,s.default)(r,d.default),this.isLock=!1,this.isReady=!1,this.isFocus=!1,this.isInput=!1,this.isRotate=!1,this.isDestroy=!1,this.whitelist=new(0,g.default)(this),this.template=new(0,y.default)(this),this.events=new(0,T.default)(this),this.whitelist.state?(this.storage=new(0,Z.default)(this),this.icons=new(0,q.default)(this),this.i18n=new(0,x.default)(this),this.notice=new(0,H.default)(this),this.player=new(0,j.default)(this),this.layers=new(0,R.default)(this),this.controls=new(0,S.default)(this),this.contextmenu=new(0,C.default)(this),this.subtitle=new(0,E.default)(this),this.info=new(0,$.default)(this),this.loading=new(0,L.default)(this),this.hotkey=new(0,D.default)(this),this.mask=new(0,Y.default)(this),this.setting=new(0,B.default)(this),this.plugins=new(0,G.default)(this)):this.mobile=new(0,J.default)(this),"function"==typeof t&&this.on("ready",(()=>t.call(this))),te.DEGUG){const e=e=>console.log(`[ART.${this.id}] -> ${e}`);e("Version@"+te.version),e("Env@"+te.env),e("Build@"+te.build);for(let t=0;t<h.default.events.length;t++)this.on("video:"+h.default.events[t],(t=>e("Event@"+t.type)))}ee.push(this)}static get instances(){return ee}static get version(){return"4.5.8"}static get env(){return"production"}static get build(){return"2022-10-09 15:14:22"}static get config(){return h.default}static get utils(){return p}static get scheme(){return d.default}static get Emitter(){return c.default}static get validator(){return s.default}static get kindOf(){return s.default.kindOf}static get html(){return y.default.html}static get option(){return{id:"",container:"#artplayer",url:"",poster:"",title:"",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,fastForward:!1,autoPlayback:!1,autoOrientation:!1,airplay:!1,layers:[],contextmenu:[],controls:[],settings:[],quality:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,column:10,width:0,height:0},subtitle:{url:"",type:"",style:{},encoding:"utf-8"},moreVideoAttr:{controls:!1,preload:p.isSafari?"auto":"metadata"},icons:{},customType:{},lang:navigator.language.toLowerCase()}}get proxy(){return this.events.proxy}get query(){return this.template.query}destroy(e=!0){this.events.destroy(),this.template.destroy(e),ee.splice(ee.indexOf(this),1),this.isDestroy=!0,this.eLine truncated
+76 -778
View File
@@ -1,693 +1,33 @@
import { Config } from './config';
import { Events } from './events';
import { Utils } from './utils';
import { Player } from './player';
import { Option } from './option';
import { Subtitle } from './subtitle';
import { Icons } from './icons';
import { Template } from './template';
import { I18n } from './i18n';
import { Setting } from './setting';
import { Component } from './component';
export = Artplayer;
export as namespace Artplayer;
type Selector = {
/**
* Whether the default is selected
*/
default?: boolean;
/**
* Html string of selector
*/
html: string | HTMLElement;
};
type ComponentOption = {
/**
* Html string or html element of component
*/
html: string | HTMLElement;
/**
* Whether to disable component
*/
disable?: boolean;
/**
* Unique name for component
*/
name?: string;
/**
* Component sort index
*/
index?: number;
/**
* Component style object
*/
style?: CSSStyleDeclaration;
/**
* Component click event
*/
click?(component: Component, event: Event): void;
/**
* Wnen the component was mounted
*/
mounted?(element: HTMLElement): void;
/**
* Component tooltip, use in controls
*/
tooltip?: string;
/**
* Component position, use in controls
*/
position?: 'top' | 'left' | 'right' | (string & Record<never, never>);
/**
* Custom selector list, use in controls
*/
selector?: Selector[];
/**
* When selector item click, use in controls
*/
onSelect?(selector: Selector, element: HTMLElement, event: Event): void;
};
type SettingOption = {
/**
* Html string or html element of setting name
*/
html: string | HTMLElement;
/**
* Html string or html element of setting icon
*/
icon?: string | HTMLElement;
/**
* The width of setting
*/
width?: number;
/**
* The tooltip of setting
*/
tooltip?: string | HTMLElement;
/**
* Whether the default is selected
*/
default?: boolean;
/**
* Custom selector list
*/
selector?: SettingOption[];
/**
* When selector item click
*/
onSelect?(item: SettingOption, element: HTMLElement, event: Event): void;
/**
* Custom switch item
*/
switch?: boolean;
/**
* When switch item click
*/
onSwitch?(item: SettingOption, element: HTMLElement, event: Event): void;
/**
* Custom range item
*/
range?: number[] | number;
/**
* When range item change
*/
onRange?(item: SettingOption, element: HTMLElement, event: Event): void;
/**
* When range item change in real time
*/
onChange?(item: SettingOption, element: HTMLElement, event: Event): void;
$icon?: HTMLElement;
$html?: HTMLElement;
$tooltip?: HTMLElement;
$switch?: boolean;
$range?: HTMLElement;
$parentItem?: SettingOption;
$parentList?: SettingOption[];
};
type Component = {
/**
* Component self-increasing id
*/
readonly id: number;
/**
* Component parent name
*/
readonly name: string | void;
/**
* Component parent element
*/
readonly $parent: HTMLElement | void;
/**
* Whether to show component parent
*/
get show(): boolean;
/**
* Whether to show component parent
*/
set show(state: boolean);
/**
* Toggle the component parent
*/
set toggle(state: boolean);
/**
* Dynamic add a component
*/
add(option: ComponentOption): HTMLElement;
};
type PluginFunction = (art: Artplayer) => any | ((option: any) => (art: Artplayer) => any);
type CustomType = (video: HTMLVideoElement, url: string, art: Artplayer) => any;
type WhitelistFunction = (ua: string) => boolean;
type EventCallback = (event: Event) => any;
type SubtitleOption = {
/**
* The subtitle url
*/
url: string;
/**
* The subtitle type
*/
type?: 'vtt' | 'srt' | 'ass' | (string & Record<never, never>);
/**
* The subtitle style object
*/
style?: CSSStyleDeclaration;
/**
* The subtitle encoding, default utf-8
*/
encoding?: string;
};
type Option = {
/**
* The player id
*/
id: string;
/**
* The container mounted by the player
*/
container: string | HTMLElement;
/**
* Video url
*/
url: string;
/**
* Video poster image url
*/
poster?: string;
/**
* Video title
*/
title?: string;
/**
* Video url type
*/
type?: string;
/**
* Player color theme
*/
theme?: string;
/**
* Player language
*/
lang?: 'en' | 'zh-cn' | 'zh-tw' | 'cs' | 'pl' | 'es' | 'fa' | (string & Record<never, never>);
/**
* Player default volume
*/
volume?: number;
/**
* Whether live broadcast mode
*/
isLive?: boolean;
/**
* Whether video muted
*/
muted?: boolean;
/**
* Whether video auto play
*/
autoplay?: boolean;
/**
* Whether player auto resize
*/
autoSize?: boolean;
/**
* Whether player auto run mini mode
*/
autoMini?: boolean;
/**
* Whether video auto loop
*/
loop?: boolean;
/**
* Whether show video flip button
*/
flip?: boolean;
/**
* Whether show video playback rate button
*/
playbackRate?: boolean;
/**
* Whether show video aspect ratio button
*/
aspectRatio?: boolean;
/**
* Whether show video screenshot button
*/
screenshot?: boolean;
/**
* Whether show video setting button
*/
setting?: boolean;
/**
* Whether to enable player hotkey
*/
hotkey?: boolean;
/**
* Whether show video pip button
*/
pip?: boolean;
/**
* Do you want to run only one player at a time
*/
mutex?: boolean;
/**
* Whether use backdrop in UI
*/
backdrop?: boolean;
/**
* Whether show video window fullscreen button
*/
fullscreen?: boolean;
/**
* Whether show video web fullscreen button
*/
fullscreenWeb?: boolean;
/**
* Whether to enable player subtitle offset
*/
subtitleOffset?: boolean;
/**
* Whether to enable player mini progress bar
*/
miniProgressBar?: boolean;
/**
* Whether use SSR function
*/
useSSR?: boolean;
/**
* Whether use playsInline in mobile
*/
playsInline?: boolean;
/**
* Whether use lock in mobile
*/
lock?: boolean;
/**
* Whether use fast forward in mobile
*/
fastForward?: boolean;
/**
* Whether use auto playback
*/
autoPlayback?: boolean;
/**
* Whether use auto orientation in mobile
*/
autoOrientation?: boolean;
/**
* Whether use airplay
*/
airplay?: boolean;
/**
* Custom plugin list
*/
plugins?: PluginFunction[];
/**
* Custom mobile whitelist
*/
whitelist?: (string | WhitelistFunction | RegExp)[];
/**
* Custom layer list
*/
layers?: ComponentOption[];
/**
* Custom contextmenu list
*/
contextmenu?: ComponentOption[];
/**
* Custom control list
*/
controls?: ComponentOption[];
/**
* Custom setting list
*/
settings?: SettingOption[];
/**
* Custom video quality list
*/
quality?: {
/**
* Whether the default is selected
*/
default?: boolean;
/**
* Html string of quality
*/
html: string | HTMLElement;
/**
* Video quality url
*/
url: string;
}[];
/**
* Custom highlight list
*/
highlight?: {
/**
* The highlight time
*/
time: number;
/**
* The highlight text
*/
text: string;
}[];
/**
* Custom thumbnail
*/
thumbnails?: {
/**
* The thumbnail image url
*/
url: string;
/**
* The thumbnail item number
*/
number?: number;
/**
* The thumbnail column size
*/
column?: number;
/**
* The thumbnail width
*/
width?: number;
/**
* The thumbnail height
*/
height?: number;
};
/**
* Custom subtitle option
*/
subtitle?: SubtitleOption;
/**
* Other video attribute
*/
moreVideoAttr?: HTMLVideoElement;
/**
* Custom default icons
*/
icons?: {
loading?: HTMLElement | string;
state?: HTMLElement | string;
play?: HTMLElement | string;
pause?: HTMLElement | string;
volume?: HTMLElement | string;
volumeClose?: HTMLElement | string;
subtitle?: HTMLElement | string;
screenshot?: HTMLElement | string;
setting?: HTMLElement | string;
fullscreen?: HTMLElement | string;
fullscreenWeb?: HTMLElement | string;
pip?: HTMLElement | string;
indicator?: HTMLElement | string;
arrowLeft?: HTMLElement | string;
arrowRight?: HTMLElement | string;
playbackRate?: HTMLElement | string;
aspectRatio?: HTMLElement | string;
config?: HTMLElement | string;
};
/**
* Custom video type function
*/
customType?: {
[key: string]: CustomType;
};
};
type AspectRatio = 'default' | '4:3' | '16:9' | void;
type PlaybackRate = 0.5 | 0.75 | 1.0 | 1.25 | 1.5 | 1.75 | 2.0 | void;
type Flip = 'normal' | 'horizontal' | 'vertical' | void;
type Events =
| 'video:canplay'
| 'video:canplaythrough'
| 'video:complete'
| 'video:durationchange'
| 'video:emptied'
| 'video:ended'
| 'video:loadeddata'
| 'video:loadeddata'
| 'video:loadedmetadata'
| 'video:pause'
| 'video:play'
| 'video:playing'
| 'video:progress'
| 'video:ratechange'
| 'video:seeked'
| 'video:seeking'
| 'video:stalled'
| 'video:suspend'
| 'video:timeupdate'
| 'video:volumechange'
| 'video:waiting'
| 'hotkey'
| 'destroy'
| 'customType'
| 'url'
| 'subtitleUpdate'
| 'subtitleLoad'
| 'subtitleSwitch'
| 'focus'
| 'blur'
| 'dblclick'
| 'click'
| 'setBar'
| 'hover'
| 'mousemove'
| 'resize'
| 'view'
| 'aspectRatio'
| 'autoHeight'
| 'autoSize'
| 'ready'
| 'error'
| 'flip'
| 'fullscreen'
| 'fullscreenWeb'
| 'loop'
| 'mini'
| 'pause'
| 'pip'
| 'playbackRate'
| 'play'
| 'screenshot'
| 'seek'
| 'subtitleOffset'
| 'switch'
| 'restart'
| 'volume'
| 'lock'
| 'selector'
| (string & Record<never, never>);
declare class Player {
get aspectRatio(): AspectRatio;
set aspectRatio(ratio: AspectRatio);
get playbackRate(): PlaybackRate;
set playbackRate(rate: PlaybackRate);
get autoSize(): boolean;
set autoSize(state: boolean);
get autoHeight(): boolean;
set autoHeight(state: boolean);
get currentTime(): number;
set currentTime(time: number);
get duration(): number;
get played(): number;
get playing(): boolean;
get flip(): Flip;
set flip(state: Flip);
get fullscreen(): boolean;
set fullscreen(state: boolean);
set fullscreenToggle(state: boolean);
get fullscreenWeb(): boolean;
set fullscreenWeb(state: boolean);
set fullscreenWebToggle(state: boolean);
get loaded(): number;
get loop(): number[];
set loop(value: number[]);
get mini(): boolean;
set mini(state: boolean);
get pip(): boolean;
set pip(state: boolean);
get poster(): string;
set poster(url: string);
get rect(): DOMRect;
get bottom(): number;
get height(): number;
get left(): number;
get right(): number;
get top(): number;
get width(): number;
get x(): number;
get y(): number;
set seek(time: number);
set forward(time: number);
set backward(time: number);
get url(): string;
set url(url: string);
get volume(): number;
set volume(percentage: number);
get muted(): boolean;
set muted(state: boolean);
get title(): string;
set title(title: string);
get theme(): string;
set theme(theme: string);
get subtitleOffset(): number;
set subtitleOffset(time: number);
pause(): void;
play(): Promise<void>;
toggle(): void;
attr(key: string, value: any): void;
switchUrl(url: string): Promise<string>;
switchQuality(url: string): Promise<string>;
getDataURL(): Promise<string>;
getBlobUrl(): Promise<string>;
screenshot(): Promise<string>;
airplay(): void;
}
declare class Artplayer extends Player {
constructor(option: Option, readyCallback?: (this: Artplayer) => void);
constructor(option: Option, readyCallback?: (this: Artplayer) => unknown);
static instances: Artplayer[];
static version: string;
static env: string;
static build: string;
static config: {
propertys: {
[key: string]: string[];
};
methods: {
[key: string]: string[];
};
events: {
[key: string]: string[];
};
prototypes: {
[key: string]: string[];
};
};
static utils: {
[key: string]: string | Function;
};
static scheme: object;
static Emitter: Function;
static validator: Function;
static kindOf: Function;
static html: string;
static option: Option;
readonly id: number;
readonly option: Option;
readonly isLock: boolean;
readonly isReady: boolean;
readonly isFocus: boolean;
readonly isInput: boolean;
readonly isRotate: boolean;
readonly isDestroy: boolean;
static readonly instances: Artplayer[];
static readonly version: string;
static readonly env: string;
static readonly build: string;
static readonly config: Config;
static readonly utils: Utils;
static readonly scheme: object;
static readonly Emitter: Function;
static readonly validator: <T extends object>(option: T, scheme: object) => T;
static readonly kindOf: (item: any) => string;
static readonly html: Artplayer['template']['html'];
static readonly option: Option;
static DEGUG: boolean;
static NOTICE_TIME: number;
@@ -719,6 +59,15 @@ declare class Artplayer extends Player {
static VOLUME_STEP: number;
static SEEK_STEP: number;
readonly id: number;
readonly option: Option;
readonly isLock: boolean;
readonly isReady: boolean;
readonly isFocus: boolean;
readonly isInput: boolean;
readonly isRotate: boolean;
readonly isDestroy: boolean;
on(name: Events, fn: Function, ctx?: object): void;
once(name: Events, fn: Function, ctx?: object): void;
emit(name: Events): void;
@@ -729,36 +78,15 @@ declare class Artplayer extends Player {
destroy(removeHtml?: boolean): void;
readonly template: {
query(str: string): HTMLElement;
readonly $container: HTMLElement;
readonly $original: HTMLElement;
readonly $player: HTMLElement;
readonly $video: HTMLElement;
readonly $poster: HTMLElement;
readonly $subtitle: HTMLElement;
readonly $danmuku: HTMLElement;
readonly $bottom: HTMLElement;
readonly $progress: HTMLElement;
readonly $controls: HTMLElement;
readonly $controlsLeft: HTMLElement;
readonly $controlsRight: HTMLElement;
readonly $layer: HTMLElement;
readonly $loading: HTMLElement;
readonly $notice: HTMLElement;
readonly $noticeInner: HTMLElement;
readonly $mask: HTMLElement;
readonly $state: HTMLElement;
readonly $setting: HTMLElement;
readonly $info: HTMLElement;
readonly $infoPanel: HTMLElement;
readonly $infoClose: HTMLElement;
readonly $miniHeader: HTMLElement;
readonly $miniTitle: HTMLElement;
readonly $miniClose: HTMLElement;
readonly $contextmenu: HTMLElement;
readonly whitelist: {
get state(): boolean;
};
readonly template: {
get html(): string;
query(str: string): HTMLElement;
} & Template;
readonly events: {
proxy<KW extends keyof WindowEventMap, KH extends keyof HTMLElementEventMap>(
element: HTMLDivElement | Document | Window,
@@ -766,61 +94,24 @@ declare class Artplayer extends Player {
handler: (event: WindowEventMap[KW] | HTMLElementEventMap[KH] | Event) => void,
options?: boolean | AddEventListenerOptions,
): () => void;
hover(element: HTMLElement, mouseenter?: EventCallback, mouseleave?: EventCallback): void;
hover(element: HTMLElement, mouseenter?: (event: Event) => any, mouseleave?: (event: Event) => any): void;
loadImg(element: HTMLImageElement | string): Promise<HTMLImageElement>;
};
readonly whitelist: {
readonly state: boolean;
};
readonly storage: {
readonly name: string;
readonly settings: object;
settings: Record<string, any>;
get(key: string): any;
set(key: string, value: any): void;
del(key: string): any;
clear(): any;
del(key: string): boolean;
clear(): void;
};
readonly icons: {
readonly loading: HTMLElement;
readonly state: HTMLElement;
readonly play: HTMLElement;
readonly pause: HTMLElement;
readonly check: HTMLElement;
readonly volume: HTMLElement;
readonly volumeClose: HTMLElement;
readonly subtitle: HTMLElement;
readonly screenshot: HTMLElement;
readonly setting: HTMLElement;
readonly fullscreen: HTMLElement;
readonly fullscreenWeb: HTMLElement;
readonly pip: HTMLElement;
readonly indicator: HTMLElement;
readonly arrowLeft: HTMLElement;
readonly arrowRight: HTMLElement;
readonly playbackRate: HTMLElement;
readonly aspectRatio: HTMLElement;
readonly config: HTMLElement;
};
readonly hotkey: {
add(key: number, callback: EventCallback): Artplayer['hotkey'];
};
readonly plugins: {
readonly id: number;
add(plugin: PluginFunction): Artplayer['plugins'];
[pluginName: string]: any;
};
readonly icons: Icons;
readonly i18n: {
readonly languages: {
[key: string]: object;
};
readonly languages: I18n;
get(key: string): string;
update(language: object): void;
update(language: Partial<I18n>): void;
};
readonly notice: {
@@ -828,31 +119,38 @@ declare class Artplayer extends Player {
set show(msg: string);
};
readonly subtitle: {
get show(): boolean;
set show(state: boolean);
set toggle(state: boolean);
get url(): string;
set url(url: string);
style(name: string | CSSStyleDeclaration, value?: string): HTMLElement;
switch(url: string, option?: SubtitleOption): Promise<string>;
};
readonly mobile: object;
readonly player: Player;
readonly info: Component;
readonly loading: Component;
readonly mask: Component;
readonly layers: Record<string, HTMLElement> & Component;
readonly controls: Record<string, HTMLElement> & Component;
readonly contextmenu: Record<string, HTMLElement> & Component;
readonly setting: Record<string, HTMLElement> & Component;
readonly subtitle: {
get url(): string;
set url(url: string);
style(name: string | Partial<CSSStyleDeclaration>, value?: string): void;
switch(url: string, option?: Subtitle): Promise<string>;
} & Component;
readonly info: Component;
readonly loading: Component;
readonly hotkey: {
keys: Record<string, ((event: Event) => any)[]>;
add(key: number, callback: (event: Event) => any): Artplayer['hotkey'];
};
readonly mask: Component;
readonly setting: {
option: Setting[];
add(setting: Setting): Artplayer['setting'];
update(): Artplayer['setting'];
} & Component;
readonly plugins: {
add(plugin: (art: Artplayer) => unknown): Artplayer['plugins'];
[pluginName: string]: any;
};
}
+105
View File
@@ -0,0 +1,105 @@
type Selector = {
/**
* Whether the default is selected
*/
default?: boolean;
/**
* Html string of selector
*/
html: string | HTMLElement;
};
export type Component = {
/**
* Component self-increasing id
*/
readonly id: number;
/**
* Component parent name
*/
readonly name: string | void;
/**
* Component parent element
*/
readonly $parent: HTMLElement | void;
/**
* Whether to show component parent
*/
get show(): boolean;
/**
* Whether to show component parent
*/
set show(state: boolean);
/**
* Toggle the component parent
*/
set toggle(state: boolean);
/**
* Dynamic add a component
*/
add(option: ComponentOption): HTMLElement;
};
export type ComponentOption = {
/**
* Html string or html element of component
*/
html: string | HTMLElement;
/**
* Whether to disable component
*/
disable?: boolean;
/**
* Unique name for component
*/
name?: string;
/**
* Component sort index
*/
index?: number;
/**
* Component style object
*/
style?: CSSStyleDeclaration;
/**
* Component click event
*/
click?(component: Component, event: Event): void;
/**
* Wnen the component was mounted
*/
mounted?(element: HTMLElement): void;
/**
* Component tooltip, use in controls
*/
tooltip?: string;
/**
* Component position, use in controls
*/
position?: 'top' | 'left' | 'right' | (string & Record<never, never>);
/**
* Custom selector list, use in controls
*/
selector?: Selector[];
/**
* When selector item click, use in controls
*/
onSelect?(selector: Selector, element: HTMLElement, event: Event): void;
};
+81
View File
@@ -0,0 +1,81 @@
export type Config = {
propertys: [
'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',
'webkitEnterFullscreen',
'webkitExitFullScreen',
'webkitExitFullscreen',
];
};
+61
View File
@@ -0,0 +1,61 @@
export type Events =
| 'video:canplay'
| 'video:canplaythrough'
| 'video:complete'
| 'video:durationchange'
| 'video:emptied'
| 'video:ended'
| 'video:loadeddata'
| 'video:loadeddata'
| 'video:loadedmetadata'
| 'video:pause'
| 'video:play'
| 'video:playing'
| 'video:progress'
| 'video:ratechange'
| 'video:seeked'
| 'video:seeking'
| 'video:stalled'
| 'video:suspend'
| 'video:timeupdate'
| 'video:volumechange'
| 'video:waiting'
| 'hotkey'
| 'destroy'
| 'customType'
| 'url'
| 'subtitleUpdate'
| 'subtitleLoad'
| 'subtitleSwitch'
| 'focus'
| 'blur'
| 'dblclick'
| 'click'
| 'setBar'
| 'hover'
| 'mousemove'
| 'resize'
| 'view'
| 'aspectRatio'
| 'autoHeight'
| 'autoSize'
| 'ready'
| 'error'
| 'flip'
| 'fullscreen'
| 'fullscreenWeb'
| 'loop'
| 'mini'
| 'pause'
| 'pip'
| 'playbackRate'
| 'play'
| 'screenshot'
| 'seek'
| 'subtitleOffset'
| 'switch'
| 'restart'
| 'volume'
| 'lock'
| 'selector'
| (string & Record<never, never>);
+42
View File
@@ -0,0 +1,42 @@
type I18nKeys = 'en' | 'zh-cn' | 'zh-tw' | 'pl' | 'cs' | 'es' | 'fa' | (string & Record<never, never>);
type I18nValue = {
'Video Info': string;
Close: string;
'Video Load Failed': string;
Volume: string;
Play: string;
Pause: string;
Rate: string;
Mute: string;
'Video Flip': string;
Horizontal: string;
Vertical: string;
Reconnect: string;
'Show Setting': string;
'Hide Setting': string;
Screenshot: string;
'Play Speed': string;
'Aspect Ratio': string;
Default: string;
Normal: string;
Open: string;
'Switch Video': string;
'Switch Subtitle': string;
Fullscreen: string;
'Exit Fullscreen': string;
'Web Fullscreen': string;
'Exit Web Fullscreen': string;
'Mini Player': string;
'PIP Mode': string;
'Exit PIP Mode': string;
'PIP Not Supported': string;
'Fullscreen Not Supported': string;
'Subtitle Offset': string;
'Last Seen': string;
'Jump Play': string;
AirPlay: string;
'AirPlay Not Available': string;
};
export type I18n = Record<I18nKeys, Partial<I18nValue>>;
+30
View File
@@ -0,0 +1,30 @@
export type Icons = {
readonly loading: HTMLDivElement;
readonly state: HTMLDivElement;
readonly play: HTMLDivElement;
readonly pause: HTMLDivElement;
readonly check: HTMLDivElement;
readonly volume: HTMLDivElement;
readonly volumeClose: HTMLDivElement;
readonly screenshot: HTMLDivElement;
readonly setting: HTMLDivElement;
readonly pip: HTMLDivElement;
readonly arrowLeft: HTMLDivElement;
readonly arrowRight: HTMLDivElement;
readonly playbackRate: HTMLDivElement;
readonly aspectRatio: HTMLDivElement;
readonly config: HTMLDivElement;
readonly lock: HTMLDivElement;
readonly flip: HTMLDivElement;
readonly unlock: HTMLDivElement;
readonly fullscreenOff: HTMLDivElement;
readonly fullscreenOn: HTMLDivElement;
readonly fullscreenWebOff: HTMLDivElement;
readonly fullscreenWebOn: HTMLDivElement;
readonly switchOn: HTMLDivElement;
readonly switchOff: HTMLDivElement;
readonly error: HTMLDivElement;
readonly close: HTMLDivElement;
readonly airplay: HTMLDivElement;
readonly [key: string]: HTMLDivElement;
};
+301
View File
@@ -0,0 +1,301 @@
import { Subtitle } from './subtitle';
import { Setting } from './setting';
import { Icons } from './icons';
import { I18n } from './i18n';
import { ComponentOption } from './component';
export type Option = {
/**
* The player id
*/
id?: string;
/**
* The container mounted by the player
*/
container: string | HTMLDivElement;
/**
* Video url
*/
url: string;
/**
* Video poster image url
*/
poster?: string;
/**
* Video title
*/
title?: string;
/**
* Video url type
*/
type?: string;
/**
* Player color theme
*/
theme?: string;
/**
* Player language
*/
lang?: keyof I18n;
/**
* Player default volume
*/
volume?: number;
/**
* Whether live broadcast mode
*/
isLive?: boolean;
/**
* Whether video muted
*/
muted?: boolean;
/**
* Whether video auto play
*/
autoplay?: boolean;
/**
* Whether player auto resize
*/
autoSize?: boolean;
/**
* Whether player auto run mini mode
*/
autoMini?: boolean;
/**
* Whether video auto loop
*/
loop?: boolean;
/**
* Whether show video flip button
*/
flip?: boolean;
/**
* Whether show video playback rate button
*/
playbackRate?: boolean;
/**
* Whether show video aspect ratio button
*/
aspectRatio?: boolean;
/**
* Whether show video screenshot button
*/
screenshot?: boolean;
/**
* Whether show video setting button
*/
setting?: boolean;
/**
* Whether to enable player hotkey
*/
hotkey?: boolean;
/**
* Whether show video pip button
*/
pip?: boolean;
/**
* Do you want to run only one player at a time
*/
mutex?: boolean;
/**
* Whether use backdrop in UI
*/
backdrop?: boolean;
/**
* Whether show video window fullscreen button
*/
fullscreen?: boolean;
/**
* Whether show video web fullscreen button
*/
fullscreenWeb?: boolean;
/**
* Whether to enable player subtitle offset
*/
subtitleOffset?: boolean;
/**
* Whether to enable player mini progress bar
*/
miniProgressBar?: boolean;
/**
* Whether use SSR function
*/
useSSR?: boolean;
/**
* Whether use playsInline in mobile
*/
playsInline?: boolean;
/**
* Whether use lock in mobile
*/
lock?: boolean;
/**
* Whether use fast forward in mobile
*/
fastForward?: boolean;
/**
* Whether use auto playback
*/
autoPlayback?: boolean;
/**
* Whether use auto orientation in mobile
*/
autoOrientation?: boolean;
/**
* Whether use airplay
*/
airplay?: boolean;
/**
* Custom plugin list
*/
plugins?: ((art: Artplayer) => unknown)[];
/**
* Custom mobile whitelist
*/
whitelist?: (string | ((ua: string) => boolean) | RegExp)[];
/**
* Custom layer list
*/
layers?: ComponentOption[];
/**
* Custom contextmenu list
*/
contextmenu?: ComponentOption[];
/**
* Custom control list
*/
controls?: ComponentOption[];
/**
* Custom setting list
*/
settings?: Setting[];
/**
* Custom video quality list
*/
quality?: {
/**
* Whether the default is selected
*/
default?: boolean;
/**
* Html string of quality
*/
html: string | HTMLElement;
/**
* Video quality url
*/
url: string;
}[];
/**
* Custom highlight list
*/
highlight?: {
/**
* The highlight time
*/
time: number;
/**
* The highlight text
*/
text: string;
}[];
/**
* Custom thumbnail
*/
thumbnails?: {
/**
* The thumbnail image url
*/
url: string;
/**
* The thumbnail item number
*/
number?: number;
/**
* The thumbnail column size
*/
column?: number;
/**
* The thumbnail width
*/
width?: number;
/**
* The thumbnail height
*/
height?: number;
};
/**
* Custom subtitle option
*/
subtitle?: Subtitle;
/**
* Other video attribute
*/
moreVideoAttr?: HTMLVideoElement;
/**
* Custom default icons
*/
icons?: {
[key in keyof Icons]?: HTMLElement | string;
};
/**
* Custom video type function
*/
customType?: Record<string, (video: HTMLVideoElement, url: string, art: Artplayer) => any>;
};
export default Option;
+70
View File
@@ -0,0 +1,70 @@
type AspectRatio = 'default' | '4:3' | '16:9' | void;
type PlaybackRate = 0.5 | 0.75 | 1.0 | 1.25 | 1.5 | 1.75 | 2.0 | void;
type Flip = 'normal' | 'horizontal' | 'vertical' | void;
export declare class Player {
get aspectRatio(): AspectRatio;
set aspectRatio(ratio: AspectRatio);
get playbackRate(): PlaybackRate;
set playbackRate(rate: PlaybackRate);
get autoSize(): boolean;
set autoSize(state: boolean);
get autoHeight(): boolean;
set autoHeight(state: boolean);
get currentTime(): number;
set currentTime(time: number);
get duration(): number;
get played(): number;
get playing(): boolean;
get flip(): Flip;
set flip(state: Flip);
get fullscreen(): boolean;
set fullscreen(state: boolean);
set fullscreenToggle(state: boolean);
get fullscreenWeb(): boolean;
set fullscreenWeb(state: boolean);
set fullscreenWebToggle(state: boolean);
get loaded(): number;
get loop(): number[];
set loop(value: number[]);
get mini(): boolean;
set mini(state: boolean);
get pip(): boolean;
set pip(state: boolean);
get poster(): string;
set poster(url: string);
get rect(): DOMRect;
get bottom(): number;
get height(): number;
get left(): number;
get right(): number;
get top(): number;
get width(): number;
get x(): number;
get y(): number;
set seek(time: number);
set forward(time: number);
set backward(time: number);
get url(): string;
set url(url: string);
get volume(): number;
set volume(percentage: number);
get muted(): boolean;
set muted(state: boolean);
get title(): string;
set title(title: string);
get theme(): string;
set theme(theme: string);
get subtitleOffset(): number;
set subtitleOffset(time: number);
pause(): void;
play(): Promise<void>;
toggle(): void;
attr(key: string, value: any): void;
switchUrl(url: string): Promise<string>;
switchQuality(url: string): Promise<string>;
getDataURL(): Promise<string>;
getBlobUrl(): Promise<string>;
screenshot(): Promise<string>;
airplay(): void;
}
+69
View File
@@ -0,0 +1,69 @@
export type Setting = {
/**
* Html string or html element of setting name
*/
html: string | HTMLElement;
/**
* Html string or html element of setting icon
*/
icon?: string | HTMLElement;
/**
* The width of setting
*/
width?: number;
/**
* The tooltip of setting
*/
tooltip?: string | HTMLElement;
/**
* Whether the default is selected
*/
default?: boolean;
/**
* Custom selector list
*/
selector?: Setting[];
/**
* When selector item click
*/
onSelect?(item: Setting, element: HTMLDivElement, event: Event): void;
/**
* Custom switch item
*/
switch?: boolean;
/**
* When switch item click
*/
onSwitch?(item: Setting, element: HTMLDivElement, event: Event): void;
/**
* Custom range item
*/
range?: number[] | number;
/**
* When range item change
*/
onRange?(item: Setting, element: HTMLDivElement, event: Event): void;
/**
* When range item change in real time
*/
onChange?(item: Setting, element: HTMLDivElement, event: Event): void;
$icon?: HTMLDivElement;
$html?: HTMLDivElement;
$tooltip?: HTMLDivElement;
$switch?: boolean;
$range?: HTMLInputElement;
$parentItem?: Setting;
$parentList?: Setting[];
};
+21
View File
@@ -0,0 +1,21 @@
export type Subtitle = {
/**
* The subtitle url
*/
url?: string;
/**
* The subtitle type
*/
type?: 'vtt' | 'srt' | 'ass' | (string & Record<never, never>);
/**
* The subtitle style object
*/
style?: Partial<CSSStyleDeclaration>;
/**
* The subtitle encoding, default utf-8
*/
encoding?: string;
};
+29
View File
@@ -0,0 +1,29 @@
export type Template = {
readonly $container: HTMLDivElement;
readonly $original: HTMLDivElement;
readonly $player: HTMLDivElement;
readonly $video: HTMLVideoElement;
readonly $track: HTMLTrackElement;
readonly $poster: HTMLDivElement;
readonly $subtitle: HTMLDivElement;
readonly $danmuku: HTMLDivElement;
readonly $bottom: HTMLDivElement;
readonly $progress: HTMLDivElement;
readonly $controls: HTMLDivElement;
readonly $controlsLeft: HTMLDivElement;
readonly $controlsRight: HTMLDivElement;
readonly $layer: HTMLDivElement;
readonly $loading: HTMLDivElement;
readonly $notice: HTMLDivElement;
readonly $noticeInner: HTMLDivElement;
readonly $mask: HTMLDivElement;
readonly $state: HTMLDivElement;
readonly $setting: HTMLDivElement;
readonly $info: HTMLDivElement;
readonly $infoPanel: HTMLDivElement;
readonly $infoClose: HTMLDivElement;
readonly $miniHeader: HTMLDivElement;
readonly $miniTitle: HTMLDivElement;
readonly $miniClose: HTMLDivElement;
readonly $contextmenu: HTMLDivElement;
};
+42
View File
@@ -0,0 +1,42 @@
export type Utils = {
userAgent: string;
isMobile: boolean;
isSafari: boolean;
isWechat: boolean;
isIE: boolean;
isAndroid: boolean;
isIOS: boolean;
query(selector: string, parent?: HTMLElement): HTMLElement;
queryAll(selector: string, parent?: HTMLElement): HTMLElement[];
addClass(target: HTMLElement, className: string): void;
removeClass(target: HTMLElement, className: string): void;
hasClass(target: HTMLElement, className: string): boolean;
append(target: HTMLElement, className: HTMLElement): HTMLElement;
remove(target: HTMLElement): void;
setStyle(element: HTMLElement, key: string, value: string): HTMLElement;
setStyles(element: HTMLElement, styles: Partial<CSSStyleDeclaration>): HTMLElement;
getStyle<T>(element: HTMLElement, key: string, numberType?: T): T extends true ? number : string;
sublings(target: HTMLElement): HTMLElement[];
inverseClass(target: HTMLElement, className: string): void;
tooltip(target: HTMLElement, msg: string, pos?: string): void;
isInViewport(target: HTMLElement, offset?: number): boolean;
includeFromEvent(event: Event, target: HTMLElement): boolean;
replaceElement(newChild: HTMLElement, oldChild: HTMLElement): HTMLElement;
createElement(tag: keyof HTMLElementTagNameMap): HTMLElement;
errorHandle<T extends boolean>(condition: T, msg: string): T extends true ? T : never;
srtToVtt(srtText: string): string;
vttToBlob(vttText: string): string;
assToVtt(assText: string): string;
getExt(url: string): string;
download(url: string, name: string): void;
def(obj: object, name: string, value: any): void;
has(obj: object, name: string): boolean;
get(obj: object, name: string): PropertyDescriptor;
mergeDeep<T>(...args: T[]): T;
sleep(ms: number): Promise<null>;
debounce(func: (...arg: any[]) => any, wait: number, context?: object): (...arg: any[]) => any;
throttle(func: (...arg: any[]) => any, wait: number): (...arg: any[]) => any;
clamp(num: number, a: number, b: number): number;
secondToTime(second: number): string;
escape(str: string): string;
};
+1 -1
View File
@@ -9,5 +9,5 @@ generateSW({
if (warnings.length > 0) {
console.warn('Warnings encountered while generating a service worker:', warnings.join('\n'));
}
console.log(`Generated a service worker, which will precache ${count} files, totaling ${size} bytes.`);
console.log(`✨ Generated a service worker, which will precache ${count} files, totaling ${size} bytes.`);
});
+16
View File
@@ -0,0 +1,16 @@
import fs from 'fs';
import path from 'path';
import glob from 'glob';
const reg = /^import.*;$/gim;
const types = glob.sync(path.join(process.cwd(), 'packages/artplayer/types/*'));
const output = path.join(path.join(process.cwd(), `docs/assets/ts/artplayer.d.ts`));
let code = '';
for (let index = 0; index < types.length; index++) {
const type = types[index];
code += String(fs.readFileSync(type)).replace(reg, '');
}
fs.writeFileSync(output, code.trim());
console.log(`✨ Built artplayer.d.ts`);
+36
View File
@@ -0,0 +1,36 @@
import Artplayer from '../packages/artplayer';
import artplayerPluginDanmuku from '../packages/artplayer-plugin-danmuku/types/artplayer-plugin-danmuku';
import artplayerPluginAds from '../packages/artplayer-plugin-ads/types/artplayer-plugin-ads';
const art = new Artplayer({
container: '.artplayer-app',
url: './assets/sample/video.mp4',
plugins: [
artplayerPluginDanmuku({
danmuku: '',
margin: [0, '10%'],
theme: 'light',
}),
artplayerPluginAds({
html: '<img src="/assets/sample/poster.jpg">',
video: '/assets/sample/test1.mp4',
url: 'http://artplayer.org',
}),
],
});
art.plugins
.add(
artplayerPluginDanmuku({
danmuku: '',
margin: [0, '10%'],
theme: 'light',
}),
)
.add(
artplayerPluginAds({
html: '<img src="/assets/sample/poster.jpg">',
video: '/assets/sample/test1.mp4',
url: 'http://artplayer.org',
}),
);
+5 -5
View File
@@ -2,7 +2,7 @@
// ======================== ES6 Module ==========================
import Artplayer from '../packages/artplayer/types/artplayer';
import Artplayer from '../packages/artplayer';
const art1 = new Artplayer({
container: '.artplayer-app',
@@ -11,7 +11,7 @@ const art1 = new Artplayer({
// ======================== CommonJS Module ==========================
const Artplayer = require('../packages/artplayer/types/artplayer');
const Artplayer = require('../packages/artplayer');
const art2 = new Artplayer({
container: '.artplayer-app',
@@ -20,7 +20,7 @@ const art2 = new Artplayer({
// ======================== Triple-Slash Directives ==========================
/// <reference path="../packages/artplayer/types/artplayer.d.ts" />
/// <reference path="../packages/artplayer" />
/**
* @type {Artplayer} - An Artplayer instance.
@@ -37,7 +37,7 @@ function getInstance(art4) {
// ======================== @typedef ==========================
/**
* @typedef { import("../packages/artplayer/types/artplayer") } Artplayer
* @typedef { import("../packages/artplayer") } Artplayer
*/
/**
@@ -55,7 +55,7 @@ function getInstance(art6) {
// ======================== @param ==========================
/**
* @param { import("../packages/artplayer/types/artplayer") } art7 - An Artplayer instance.
* @param { import("../packages/artplayer") } art7 - An Artplayer instance.
*/
function getInstance(art7) {
//
-30
View File
@@ -1,36 +1,6 @@
import Artplayer from '../packages/artplayer';
import artplayerPluginDanmuku from '../packages/artplayer-plugin-danmuku';
import artplayerPluginAds from '../packages/artplayer-plugin-ads';
const art = new Artplayer({
container: '.artplayer-app',
url: './assets/sample/video.mp4',
plugins: [
artplayerPluginDanmuku({
danmuku: '',
margin: [0, '10%'],
theme: 'light',
}),
artplayerPluginAds({
html: '<img src="/assets/sample/poster.jpg">',
video: '/assets/sample/test1.mp4',
url: 'http://artplayer.org',
}),
],
});
art.plugins
.add(
artplayerPluginDanmuku({
danmuku: '',
margin: [0, '10%'],
theme: 'light',
}),
)
.add(
artplayerPluginAds({
html: '<img src="/assets/sample/poster.jpg">',
video: '/assets/sample/test1.mp4',
url: 'http://artplayer.org',
}),
);
-21
View File
@@ -1,21 +0,0 @@
<script setup>
import Artplayer from 'artplayer/examples/vue/Artplayer.vue';
const option = {
url: 'https://artplayer.org/assets/sample/video.mp4',
};
const style = {
width: '600px',
height: '400px',
margin: '60px auto 0',
};
function getInstance(art) {
console.log(art);
}
</script>
<template>
<Artplayer @get-instance="getInstance" :option="option" :style="style" />
</template>