diff --git a/dist/artplayer-plugin-backlight.js b/dist/artplayer-plugin-backlight.js new file mode 100644 index 000000000..1a026168f --- /dev/null +++ b/dist/artplayer-plugin-backlight.js @@ -0,0 +1,8 @@ +/*! + * artplayer-plugin-backlight.js v4.0.0 + * Github: https://github.com/zhw2590582/ArtPlayer#readme + * (c) 2017-2021 Harvey Zack + * Released under the MIT License. + */ + +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).artplayerPluginBacklight=e()}(this,(function(){"use strict";function t(t){for(var e=[],o=0;o<10;o+=1)for(var n=0;n<5;n+=1)0!==o&&9!==o&&0!==n&&4!==n||e.push(t(o,n,10,5));return e}return function(e){var o=e.constructor.utils.setStyles,n=e.template,a=n.$player,i=n.$video,r=e.player,c=document.createElement("div");c.classList.add("artplayer-backlight"),o(c,{position:"absolute",zIndex:9,left:0,top:0,right:0,bottom:0,width:"100%",height:"100%"});var l,s=(l=c,t((function(t,e,o,n){var a=document.createElement("div");return a.style.position="absolute",a.style.left="".concat(100*t/o,"%"),a.style.top="".concat(100*e/n,"%"),a.style.width="".concat(100/o,"%"),a.style.height="".concat(100/n,"%"),a.style.webkitBorderRadius="50%",a.style.borderRadius="50%",a.style.webkitTransition="all .2s ease",a.style.transition="all .2s ease",l.appendChild(a),{$box:a,left:0===t,right:t===o-1,top:0===e,bottom:e===n-1}}))),u=document.createElement("canvas");return a.insertBefore(c,i),function o(){setTimeout((function(){if(r.playing){var n=i.clientWidth,a=i.clientHeight,c=function(e,o,n,a){var i=e.getContext("2d");return e.width=n,e.height=a,i.drawImage(o,0,0),t((function(t,e,o,r){for(var c=n/o,l=a/r,s=t*c,u=e*l,d=i.getImageData(s,u,c,l).data,f=0,h=0,p=0,g=0,y=d.length;g'.concat(e.get("Danmu opacity"),': 100%
'),mounted:function(e){var i=e.querySelector("input[type=range]"),r=e.querySelector(".art-value");n(i,"change",(function(){var e=i.value;r.innerText=100*Number(e),t.plugins.artplayerPluginDanmuku.config({opacity:Number(e)})})),t.on("artplayerPluginDanmuku:config",(function(t){i.value!==t.opacity&&(i.value=t.opacity,r.innerText=100*t.opacity)}))}}}function r(t){var e=t.i18n,n=t.events.proxy;return{name:"danmuku-size",index:11,html:'
'.concat(e.get("Danmu size"),': 25px
'),mounted:function(e){var i=e.querySelector("input[type=range]"),r=e.querySelector(".art-value");n(i,"change",(function(){var e=i.value;r.innerText=e,t.plugins.artplayerPluginDanmuku.config({fontSize:Number(e)})})),t.on("artplayerPluginDanmuku:config",(function(t){i.value!==t.fontSize&&(i.value=t.fontSize,r.innerText=t.fontSize)}))}}}function a(t){var e=t.i18n,n=t.events.proxy;return{name:"danmuku-speed",index:12,html:'
'.concat(e.get("Danmu speed"),': 5s
'),mounted:function(e){var i=e.querySelector("input[type=range]"),r=e.querySelector(".art-value");n(i,"change",(function(){var e=i.value;r.innerText=e,t.plugins.artplayerPluginDanmuku.config({speed:Number(e)})})),t.on("artplayerPluginDanmuku:config",(function(t){i.value!==t.speed&&(i.value=t.speed,r.innerText=t.speed)}))}}}function o(t){var e=t.i18n,n=t.events.proxy;return{name:"danmuku-synchronousPlayback",index:13,html:'"),mounted:function(e){var i=e.querySelector("input[type=checkbox]");n(i,"change",(function(){t.plugins.artplayerPluginDanmuku.config({synchronousPlayback:i.checked})})),t.on("artplayerPluginDanmuku:config",(function(t){i.checked!==t.synchronousPlayback&&(i.checked=t.synchronousPlayback)}))}}}function u(t,e,n){return t.filter((function(t){return t.$state===e})).map(n)}function s(t,e){var n=t.getBoundingClientRect();return e?n[e]:n}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n[\S ]*?)<\/d>/gi);return e&&e.length?e.map((function(t){var e=c(t.match(/(.+)<\/d>/),3),n=e[1],i=e[2],r=n.split(",");return 8===r.length&&i.trim()?{text:i,time:Number(r[0]),mode:p(Number(r[1])),fontSize:Number(r[2]),color:"#".concat(Number(r[3]).toString(16)),timestamp:Number(r[4]),pool:Number(r[5]),userID:r[6],rowID:Number(r[7])}:null})):[]}(t)}))}function h(t,e){var n=c(t.option.margin,2),i=n[0],r=n[1],a=s(t.art.template.$player),o=t.queue.filter((function(t){return t.mode===e.mode&&"emit"===t.$state&&t.$ref&&t.$ref.style.fontSize===e.$ref.style.fontSize&&parseFloat(t.$ref.style.top)<=a.height-r})).map((function(t){var e=s(t.$ref),n=e.width,i=e.height,r=e.top-a.top,o=e.left-a.left;return{top:r,left:o,height:i,width:n,right:a.width-o-n}})).sort((function(t,e){return t.top-e.top}));return 0===o.length?i:(o.unshift({top:0,left:0,right:0,height:i,width:a.width}),o.push({top:a.height-r,left:0,right:0,height:r,width:a.width}),function(t){for(var e=0,n={},i=0;io&&(e=p,o=f)}if(0===e)for(var h=0,m=0;mh&&(h=d,e=c(g,1)[0].top)}if(0===e){var x=a.filter((function(t,e){return 0!==e&&e!==a.length-1})).sort((function(t,e){return n[t].length-n[e].length}));e=c(x,1)[0]}return e}(o))}function m(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function d(e){for(var n=1;n=t.time&&t.time>=n.currentTime-.1&&"wait"===t.$state})).forEach((function(i){i.$ref=function(t){var e=t.find((function(t){return t.$ref&&"wait"===t.$state}));if(e){var n=e.$ref;return e.$ref=null,n}var i=document.createElement("div");return i.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-family: SimHei, "Microsoft JhengHei", Arial, Helvetica, sans-serif;\n font-weight: normal;\n line-height: 1.125;\n text-shadow: rgb(0, 0, 0) 1px 0px 1px, rgb(0, 0, 0) 0px 1px 1px, rgb(0, 0, 0) 0px -1px 1px, rgb(0, 0, 0) -1px 0px 1px;\n ',i}(t.queue),t.$danmuku.appendChild(i.$ref),i.$ref.style.opacity=t.option.opacity,i.$ref.style.fontSize="".concat(t.option.fontSize,"px"),i.$ref.innerText=i.text,i.$ref.style.color=i.color||"#fff",i.$ref.style.border=i.border?"1px solid ".concat(i.color||"#fff"):"none",i.$restTime=t.option.synchronousPlayback&&n.playbackRate?t.option.speed/Number(n.playbackRate):t.option.speed,i.$lastStartTime=Date.now();var r=s(i.$ref,"width"),a=h(t,i);switch(i.$state="emit",i.mode){case 0:i.$restWidth=e+r+5,i.$ref.style.left="".concat(e,"px"),i.$ref.style.top="".concat(a,"px"),i.$ref.style.transform="translateX(".concat(-i.$restWidth,"px) translateY(0px) translateZ(0px)"),i.$ref.style.transition="transform ".concat(i.$restTime,"s linear 0s");break;case 1:i.$ref.style.top="".concat(a,"px"),i.$ref.style.left="50%",i.$ref.style.marginLeft="-".concat(r/2,"px")}}))}t.isStop||t.update()})),this}},{key:"stop",value:function(){return this.isStop=!0,this.suspend(),window.cancelAnimationFrame(this.animationFrameTimer),this.art.emit("artplayerPluginDanmuku:stop"),this}},{key:"start",value:function(){return this.isStop=!1,this.continue(),this.update(),this.art.emit("artplayerPluginDanmuku:start"),this}},{key:"show",value:function(){return this.isHide=!1,this.$danmuku.style.display="block",this.art.emit("artplayerPluginDanmuku:show"),this}},{key:"hide",value:function(){return this.isHide=!0,this.$danmuku.style.display="none",this.art.emit("artplayerPluginDanmuku:hide"),this}},{key:"emit",value:function(t){var e=this.art,n=e.notice,i=e.player,r=e.i18n,a=this.art.constructor,o=a.utils.clamp;return(0,a.validator)(t,{text:"string",mode:"number|undefined",color:"string|undefined",time:"number|undefined",border:"boolean|undefined"}),t.text.trim()?t.text.length>this.option.maxlength?(n.show="".concat(r.get("The length of the danmu does not exceed")," ").concat(this.option.maxlength),this):(t.time?t.time=o(t.time,0,1/0):t.time=i.currentTime+.5,this.queue.push(d(d({mode:0},t),{},{$state:"wait",$ref:null,$restTime:0,$lastStartTime:0,$restWidth:0})),this):(n.show=r.get("Danmu text cannot be empty"),this)}}],p=[{key:"option",get:function(){return{danmuku:[],speed:5,maxlength:50,margin:[10,100],opacity:1,fontSize:25,synchronousPlayback:!1}}},{key:"scheme",get:function(){return{danmuku:"array|function|string",speed:"number",maxlength:"number",margin:"array",opacity:"number",fontSize:"number",synchronousPlayback:"boolean"}}}],c&&e(l.prototype,c),p&&e(l,p),t}();return function(t){return function(e){var n=new y(e,t);return{name:"artplayerPluginDanmuku",emit:n.emit.bind(n),config:n.config.bind(n),hide:n.hide.bind(n),show:n.show.bind(n),get isHide(){return n.isHide}}}}})); diff --git a/dist/artplayer-tool-github.js b/dist/artplayer-tool-github.js new file mode 100644 index 000000000..ea6ea12e3 --- /dev/null +++ b/dist/artplayer-tool-github.js @@ -0,0 +1,8 @@ +/*! + * artplayer-tool-github.js v4.0.0 + * Github: https://github.com/zhw2590582/ArtPlayer#readme + * (c) 2017-2021 Harvey Zack + * Released under the MIT License. + */ + +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).ArtplayerToolGithub=e()}(this,(function(){"use strict";"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var t={exports:{}};return function(t,e){t.exports=function(){var t,e=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t},r=function(t){for(var r=1;r0&&void 0!==arguments[0]?arguments[0]:{};return t(this,f),(e=u.call(this)).processing=!1,e.option={},e.setup(Object.assign({},f.DEFAULTS,i)),e.video=f.creatVideo(),e.duration=0,e.inputChange=e.inputChange.bind(n(e)),e.ondrop=e.ondrop.bind(n(e)),e.option.fileInput.addEventListener("change",e.inputChange),e.option.fileInput.addEventListener("dragover",f.ondragover),e.option.fileInput.addEventListener("drop",f.ondrop),e}return r=f,a=[{key:"ondrop",value:function(t){t.preventDefault();var e=t.dataTransfer.files[0];this.loadVideo(e)}},{key:"setup",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.option=Object.assign({},this.option,e);var n=this.option,i=n.fileInput,o=n.delay,r=n.number,a=n.width,s=n.height,u=n.column;if(this.errorHandle(i instanceof Element,"The 'fileInput' is not a Element"),"INPUT"!==i.tagName||"file"!==i.type){i.style.position="relative";var h=document.createElement("input");h.type="file",h.style.position="absolute",h.style.width="100%",h.style.height="100%",h.style.left="0",h.style.top="0",h.style.right="0",h.style.bottom="0",h.style.opacity="0",i.appendChild(h),this.option.fileInput=h}return["delay","number","width","height","column","begin","end"].forEach((function(e){t.errorHandle("number"==typeof t.option[e],"The '".concat(e,"' is not a number"))})),this.option.delay=l(o,10,1e3),this.option.number=l(r,10,1e3),this.option.width=l(a,10,1e3),this.option.height=l(s,10,1e3),this.option.column=l(u,1,1e3),this}},{key:"inputChange",value:function(){var t=this.option.fileInput.files[0];this.loadVideo(t)}},{key:"loadVideo",value:function(t){var e=this,n=this.option.delay;if(t){var i=this.video.canPlayType(t.type);this.errorHandle("maybe"===i||"probably"===i,"Playback of this file format is not supported: ".concat(t.type));var o=URL.createObjectURL(t);this.videoUrl=o,this.file=t,this.emit("file",this.file),this.video.src=o,h(n).then((function(){e.emit("video",e.video)})).catch((function(t){throw e.emit("error",t.message),t}))}}},{key:"start",value:function(){var t=this;if(!this.video.duration)return h(1e3).then(this.start);var e=this.option,n=e.width,i=e.height,o=e.number,r=e.delay,a=e.begin,s=e.end;this.option.begin=l(a,0,this.video.duration),this.option.end=l(s||this.video.duration,a,this.video.duration),this.errorHandle(this.option.end>this.option.begin,"End time must be greater than the start time"),this.duration=this.option.end-this.option.begin,this.density=o/this.duration,this.errorHandle(this.file&&this.video,"Please select the video file first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment..."),this.errorHandle(this.density<=1,"The preview density cannot be greater than 1, but got ".concat(this.density));var u=this.creatScreenshotDate(),c=this.creatCanvas(),f=c.getContext("2d");this.emit("canvas",c);var p,d=u.map((function(e,a){return function(){return t.video.currentTime=e.time,new Promise((function(s){h(r).then((function(){f.drawImage(t.video,e.x,e.y,n,i),c.toBlob((function(e){t.thumbnailUrl&&URL.revokeObjectURL(t.thumbnailUrl),t.thumbnailUrl=URL.createObjectURL(e),t.emit("update",t.thumbnailUrl,(a+1)/o),s()}))})).catch((function(t){throw t}))}))}}));return this.processing=!0,(p=d,p.reduce((function(t,e){return t.then(e)}),Promise.resolve())).then((function(){return h(2*r).then((function(){t.processing=!1,t.emit("done")})).catch((function(e){throw t.processing=!1,t.emit("error",e.message),e}))})).catch((function(e){throw t.processing=!1,t.emit("error",e.message),e}))}},{key:"creatScreenshotDate",value:function(){for(var t=this.option,e=t.number,n=t.width,i=t.height,o=t.column,r=t.begin,a=this.duration/e,s=[r+a];s.length1?r-1:0),o=1;o1&&void 0!==arguments[1]?arguments[1]:document;return e.querySelector(t)}function g(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(e.querySelectorAll(t))}function m(t,e){return t.classList.add(e)}function b(t,e){return t.classList.remove(e)}function w(t,e){return t.classList.contains(e)}function x(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function O(t,e,r){return t.style[e]=r,t}function k(t,e){return Object.keys(e).forEach((function(r){O(t,r,e[r])})),t}function j(t,e){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=window.getComputedStyle(t,null).getPropertyValue(e);return r?parseFloat(n):n}function P(t){return Array.from(t.parentElement.children).filter((function(e){return e!==t}))}function S(t,e){P(t).forEach((function(t){return b(t,e)})),m(t,e)}function E(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"up";d||(t.setAttribute("aria-label",e),t.setAttribute("data-balloon-pos",r))}function R(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=t.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight,o=window.innerWidth||document.documentElement.clientWidth,i=r.top-e<=n&&r.top+r.height+e>=0,a=r.left-e<=o+e&&r.left+r.width+e>=0;return i&&a}function $(t,e){return t.composedPath&&t.composedPath().indexOf(e)>-1}function T(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function D(t,e,r){return D=T()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var i=new(Function.bind.apply(t,n));return r&&o(i,r.prototype),i},D.apply(null,arguments)}function z(t){var e="function"==typeof Map?new Map:void 0;return z=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return D(t,arguments,l(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),o(n,t)},z(t)}function A(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l(t);if(e){var o=l(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var C=function(e){i(o,e);var r=A(o);function o(e,i){var a;return t(this,o),a=r.call(this,e),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(n(a),i||a.constructor),a.name="ArtPlayerError",a}return o}(z(Error));function L(t,e){if(!t)throw new C(e);return t}function M(t){return"WEBVTT \r\n\r\n".concat(t.replace(/{[\s\S]*?}/g,"").replace(/\{\\([ibu])\}/g,"").replace(/\{\\([ibu])1\}/g,"<$1>").replace(/\{([ibu])\}/g,"<$1>").replace(/\{\/([ibu])\}/g,"").replace(/(\d\d:\d\d:\d\d),(\d\d\d)/g,"$1.$2").concat("\r\n\r\n"))}function F(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function q(t){var e=new RegExp("Dialogue:\\s\\d,(\\d+:\\d\\d:\\d\\d.\\d\\d),(\\d+:\\d\\d:\\d\\d.\\d\\d),([^,]*),([^,]*),(?:[^,]*,){4}([\\s\\S]*)$","i");function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return t.split(/[:.]/).map((function(t,e,r){if(e===r.length-1){if(1===t.length)return".".concat(t,"00");if(2===t.length)return".".concat(t,"0")}else if(1===t.length)return(0===e?"0":":0")+t;return 0===e?t:e===r.length-1?".".concat(t):":".concat(t)})).join("")}return"WEBVTT\n\n".concat(t.split(/\r?\n/).map((function(t){var n=t.match(e);return n?{start:r(n[1].trim()),end:r(n[2].trim()),text:n[5].replace(/{[\s\S]*?}/g,"").replace(/(\\N)/g,"\n").trim().split(/\r?\n/).map((function(t){return t.trim()})).join("\n")}:null})).filter((function(t){return t})).map((function(t,e){return t?"".concat(e+1,"\n").concat(t.start," --\x3e ").concat(t.end,"\n").concat(t.text):""})).filter((function(t){return t.trim()})).join("\n\n"))}function B(t){return t.includes("?")?B(t.split("?")[0]):t.includes("#")?B(t.split("#")[0]):t.trim().toLowerCase().split(".").pop()}function I(t,e){var r=document.createElement("a");r.style.display="none",r.href=t,r.download=e,document.body.appendChild(r),r.click(),document.body.removeChild(r)}function V(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r1?e-1:0),n=1;n0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(e){return setTimeout(e,t)}))}function Y(t,e){var r,n,o=!1;return function i(){for(var a=arguments.length,c=new Array(a),l=0;l0?[e,r,n]:[r,n]).map((function(t){return t<10?"0".concat(t):String(t)})).join(":")}function G(t){return t.replace(/[&<>'"]/g,(function(t){return{"&":"&","<":"<",">":">","'":"'",'"':"""}[t]||t}))}var K=Object.freeze({__proto__:null,query:v,queryAll:g,addClass:m,removeClass:b,hasClass:w,append:x,remove:function(t){return t.parentNode.removeChild(t)},setStyle:O,setStyles:k,getStyle:j,sublings:P,inverseClass:S,tooltip:E,isInViewport:R,includeFromEvent:$,ArtPlayerError:C,errorHandle:L,srtToVtt:M,vttToBlob:F,assToVtt:q,getExt:B,download:I,def:H,has:U,proxyPropertys:_,mergeDeep:X,sleep:Q,debounce:function(t,e,r){var n;function o(){for(var o=arguments.length,i=new Array(o),a=0;a-1;case"function":return t(r.userAgent);case"regexp":return t.test(r.userAgent);default:return!1}}))},dt=function(){function e(r){var n=this;t(this,e),this.art=r,this.art.query=this.query.bind(this),r.option.container instanceof Element?this.$container=r.option.container:(this.$container=v(r.option.container),L(this.$container,"No container element found by ".concat(r.option.container))),L(r.constructor.instances.every((function(t){return t.template.$container!==n.$container})),"Cannot mount multiple instances on the same dom element"),r.whitelist.state?this.desktop():this.mobile()}return r(e,[{key:"query",value:function(t){return v(t,this.$container)}},{key:"desktop",value:function(){var t=this.art.option,r=t.backdrop,n=t.theme;t.useSSR||(this.$container.innerHTML=e.html),this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video"),this.$poster=this.query(".art-poster"),this.$subtitle=this.query(".art-subtitle"),this.$danmuku=this.query(".art-danmuku"),this.$bottom=this.query(".art-bottom"),this.$progress=this.query(".art-progress"),this.$controls=this.query(".art-controls"),this.$controlsLeft=this.query(".art-controls-left"),this.$controlsRight=this.query(".art-controls-right"),this.$layer=this.query(".art-layers"),this.$loading=this.query(".art-loading"),this.$notice=this.query(".art-notice"),this.$noticeInner=this.query(".art-notice-inner"),this.$mask=this.query(".art-mask"),this.$state=this.query(".art-state"),this.$setting=this.query(".art-settings"),this.$settingInner=this.query(".art-setting-inner"),this.$settingBody=this.query(".art-setting-body"),this.$info=this.query(".art-info"),this.$infoPanel=this.query(".art-info-panel"),this.$infoClose=this.query(".art-info-close"),this.$miniHeader=this.query(".art-mini-header"),this.$miniTitle=this.query(".art-mini-title"),this.$miniClose=this.query(".art-mini-close"),this.$contextmenu=this.query(".art-contextmenus"),this.$player.style.setProperty("--theme",n),r&&(m(this.$settingInner,"art-backdrop-filter"),m(this.$contextmenu,"art-backdrop-filter"),m(this.$info,"art-backdrop-filter")),this.art.isMobile&&m(this.$container,"art-mobile")}},{key:"mobile",value:function(){this.$container.innerHTML='
',this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video")}},{key:"destroy",value:function(t){t?this.$container.innerHTML="":m(this.$player,"art-destroy")}}],[{key:"html",get:function(){return'
Player version:
4.0.0
Video url:
Video volume:
Video time:
Video duration:
Video resolution:
x
[x]
xD7
'}}]),e}(),ht={"Video info":"统计信息",Close:"关闭","Video load failed":"加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音",Flip:"翻转",Rotate:"旋转",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新连接","Hide subtitle":"隐藏字幕","Show subtitle":"显示字幕","Hide danmu":"隐藏弹幕","Show danmu":"显示弹幕","Show setting":"显示设置","Hide setting":"隐藏设置",Screenshot:"截图","Play speed":"播放速度","Aspect ratio":"画面比例",Default:"默认",Normal:"正常",Open:"打开","Switch video":"切换","Switch subtitle":"切换字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"网页全屏","Exit web fullscreen":"退出网页全屏","Mini player":"迷你播放器","PIP mode":"画中画模式","Exit PIP mode":"退出画中画模式","PIP not supported":"不支持画中画模式","Fullscreen not supported":"不支持全屏模式","Local Subtitle":"本地字幕","Local Video":"本地视频","Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},yt={"Video info":"統計訊息",Close:"關閉","Video load failed":"載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"翻轉",Rotate:"旋轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide subtitle":"隱藏字幕","Show subtitle":"顯示字幕","Hide danmu":"隱藏彈幕","Show danmu":"顯示彈幕","Show setting":"顯示设置","Hide setting":"隱藏设置",Screenshot:"截圖","Play speed":"播放速度","Aspect ratio":"畫面比例",Default:"默認",Normal:"正常",Open:"打開","Switch video":"切換","Switch subtitle":"切換字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"網頁全屏","Exit web fullscreen":"退出網頁全屏","Mini player":"迷你播放器","PIP mode":"畫中畫模式","Exit PIP mode":"退出畫中畫模式","PIP not supported":"不支持畫中畫模式","Fullscreen not supported":"不支持全屏模式","Local Subtitle":"本地字幕","Local Video":"本地視頻","Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"},vt=function(){function e(r){t(this,e),this.art=r,this.languages={"zh-cn":ht,"zh-tw":yt},this.init()}return r(e,[{key:"init",value:function(){var t=this.art.option.lang.toLowerCase();this.language=this.languages[t]||{}}},{key:"get",value:function(t){return this.language[t]||t}},{key:"update",value:function(t){this.languages=X(this.languages,t),this.init()}}]),e}();var gt={exports:{}};!function(t){!function(){var e="undefined"!=typeof window&&void 0!==window.document?window.document:{},r=t.exports,n=function(){for(var t,r=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],n=0,o=r.length,i={};nd){var h=d*s/l;O(n,"width","".concat(100*h,"%")),O(n,"height","100%"),O(n,"padding","0 ".concat((u-u*h)/2,"px"))}else{var y=l/d/s;O(n,"width","100%"),O(n,"height","".concat(100*y,"%")),O(n,"padding","".concat((p-p*y)/2,"px 0"))}o.dataset.aspectRatio=e}a.show="".concat(i.get("Aspect ratio"),": ").concat("default"===e?i.get("Default"):e),t.emit("aspectRatio",e)}}),H(e,"aspectRatioReset",{set:function(t){if(t&&e.aspectRatio){var r=e.aspectRatio;e.aspectRatio=r}}})}(r,this),function(t,e){var r=t.option,n=t.notice,o=t.template.$video,i=document.createElement("canvas");H(e,"getDataURL",{value:function(){return new Promise((function(t,e){try{i.width=o.videoWidth,i.height=o.videoHeight,i.getContext("2d").drawImage(o,0,0),t(i.toDataURL("image/png"))}catch(t){n.show=t,e(t)}}))}}),H(e,"getBlobUrl",{value:function(){return new Promise((function(t,e){try{i.width=o.videoWidth,i.height=o.videoHeight,i.getContext("2d").drawImage(o,0,0),i.toBlob((function(e){t(URL.createObjectURL(e))}))}catch(t){n.show=t,e(t)}}))}}),H(e,"screenshot",{value:function(){e.getDataURL().then((function(e){I(e,"".concat(r.title||"artplayer","_").concat(J(o.currentTime),".png")),t.emit("screenshot",e)}))}})}(r,this),bt(r,this),function(t,e){var r=t.template.$player;H(e,"fullscreenWeb",{get:function(){return w(r,"art-fullscreen-web")},set:function(n){n?(m(r,"art-fullscreen-web"),e.aspectRatioReset=!0,t.emit("resize"),t.emit("fullscreenWeb",!0)):(b(r,"art-fullscreen-web"),e.aspectRatioReset=!0,e.autoSize=t.option.autoSize,t.emit("resize"),t.emit("fullscreenWeb"))}}),H(e,"fullscreenWebToggle",{set:function(t){t&&(e.fullscreenWeb=!e.fullscreenWeb)}})}(r,this),wt(r,this),function(t,e){var r=t.template.$video;H(e,"loaded",{get:function(){return e.loadedTime/r.duration}}),H(e,"loadedTime",{get:function(){return r.buffered.length?r.buffered.end(r.buffered.length-1):0}})}(r,this),function(t,e){H(e,"played",{get:function(){return e.currentTime/e.duration}})}(0,this),function(t,e){var r=t.template.$video;H(e,"playing",{get:function(){return!!(r.currentTime>0&&!r.paused&&!r.ended&&r.readyState>2)}})}(r,this),function(t,e){var r=t.template,n=r.$container,o=r.$player,i=r.$video;H(e,"autoSize",{get:function(){return w(n,"art-auto-size")},set:function(r){if(r){var a=i.videoWidth,c=i.videoHeight,l=n.getBoundingClientRect(),s=l.width,u=l.height,p=a/c,f=s/u;if(m(n,"art-auto-size"),f>p)O(o,"width","".concat(u*p/s*100,"%")),O(o,"height","100%");else{var d=s/p/u*100;O(o,"width","100%"),O(o,"height","".concat(d,"%"))}t.emit("autoSize",{width:e.width,height:e.height})}else b(n,"art-auto-size"),O(o,"width",null),O(o,"height",null),t.emit("autoSize")}})}(r,this),function(t,e){H(e,"rect",{get:function(){return t.template.$player.getBoundingClientRect()}}),["bottom","height","left","right","top","width"].forEach((function(t){H(e,t,{get:function(){return e.rect[t]}})})),H(e,"x",{get:function(){return e.left+window.pageXOffset}}),H(e,"y",{get:function(){return e.top+window.pageYOffset}})}(r,this),function(t,e){var r=t.template.$player,n=t.i18n,o=t.notice;H(e,"flip",{get:function(){return r.dataset.flip},set:function(i){i||(i="normal");var a=["normal","horizontal","vertical"];L(a.includes(i),"'flip' only accept ".concat(a.toString()," as parameters")),"normal"===i?delete r.dataset.flip:(e.rotate=!1,r.dataset.flip=i);var c=i.replace(i[0],i[0].toUpperCase());o.show="".concat(n.get("Flip"),": ").concat(n.get(c)),t.emit("flip",i)}}),H(e,"flipReset",{set:function(t){if(t&&e.flip){var r=e.flip;e.flip=r}}})}(r,this),function(t,e){var r=t.i18n,n=t.option,o=t.storage,i=t.events.proxy,a=t.template,c=a.$player,l=a.$miniClose,s=a.$miniTitle,u=a.$miniHeader,p="",f=!1,d=0,h=0,y=0,v=0;i(u,"mousedown",(function(t){f=!0,d=t.pageX,h=t.pageY,y=e.left,v=e.top})),i(document,"mousemove",(function(t){if(f){m(c,"art-is-dragging");var e=v+t.pageY-h,r=y+t.pageX-d;O(c,"top","".concat(e,"px")),O(c,"left","".concat(r,"px")),o.set("top",e),o.set("left",r)}})),i(document,"mouseup",(function(){f=!1,b(c,"art-is-dragging")})),i(l,"click",(function(){e.mini=!1,f=!1,b(c,"art-is-dragging")})),x(s,n.title||r.get("Mini player")),H(e,"mini",{get:function(){return w(c,"art-mini")},set:function(r){if(r){e.autoSize=!1,p=c.style.cssText,m(c,"art-mini");var i=o.get("top"),a=o.get("left");if(i&&a)O(c,"top","".concat(i,"px")),O(c,"left","".concat(a,"px")),R(u)||(o.del("top"),o.del("left"),e.mini=!0);else{var l=document.body,s=l.clientHeight-e.height-50,f=l.clientWidth-e.width-50;o.set("top",s),o.set("left",f),O(c,"top","".concat(s,"px")),O(c,"left","".concat(f,"px"))}e.aspectRatio=!1,e.playbackRate=!1,t.emit("mini",!0)}else c.style.cssText=p,b(c,"art-mini"),O(c,"top",null),O(c,"left",null),e.aspectRatio=!1,e.playbackRate=!1,e.autoSize=n.autoSize,t.emit("mini")}}),H(e,"miniToggle",{set:function(t){t&&(e.mini=!e.mini)}})}(r,this),function(t,e){var r=[];H(e,"loop",{get:function(){return r},set:function(n){if(Array.isArray(n)&&"number"==typeof n[0]&&"number"==typeof n[1]){var o=Z(n[0],0,Math.min(n[1],e.duration)),i=Z(n[1],o,e.duration);i-o>=1?(r=[o,i],t.emit("loop",r)):(r=[],t.emit("loop"))}else r=[],t.emit("loop")}}),t.on("video:timeupdate",(function(){r.length&&(e.currentTimer[1])&&(e.seek=r[0])}))}(r,this),function(t,e){var r=t.template,n=r.$video,o=r.$player,i=t.i18n,a=t.notice;H(e,"rotate",{get:function(){return Number(o.dataset.rotate)||0},set:function(r){r||(r=0);var c=[-270,-180,-90,0,90,180,270];if(L(c.includes(r),"'rotate' only accept ".concat(c.toString()," as parameters")),0===r)delete o.dataset.rotate,O(n,"transform",null);else{e.flip=!1,t.autoSize=!0,o.dataset.rotate=r;var l=function(){var t=n.videoWidth,e=n.videoHeight;return t>e?e/t:t/e},s=0,u=1;switch(r){case-270:s=90,u=l();break;case-180:s=180;break;case-90:s=270,u=l();break;case 90:s=90,u=l();break;case 180:s=180;break;case 270:s=270,u=l()}O(n,"transform","rotate(".concat(s,"deg) scale(").concat(u,")"))}a.show="".concat(i.get("Rotate"),": ").concat(r,"°"),t.emit("rotate",r)}}),H(e,"rotateReset",{set:function(t){if(t&&e.rotate){var r=e.rotate;e.rotate=r}}})}(r,this),function(t,e){var r=t.option,n=t.template.$poster;H(e,"poster",{get:function(){return r.poster},set:function(t){r.poster=t,O(n,"backgroundImage","url(".concat(t,")"))}})}(r,this),_(r,this)};function Ot(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=l(t)););return t}function kt(){return kt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=Ot(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(arguments.length<3?t:r):o.value}},kt.apply(this,arguments)}var jt=function(){function e(r){t(this,e),this.id=0,this.art=r,this.add=this.add.bind(this)}return r(e,[{key:"show",get:function(){return w(this.art.template.$player,"art-".concat(this.name,"-show"))},set:function(t){var e=this.art.template.$player,r="art-".concat(this.name,"-show");t?m(e,r):b(e,r),this.art.emit(this.name,t)}},{key:"toggle",set:function(t){t&&(this.show=!this.show)}},{key:"add",value:function(t){var e=this,r="function"==typeof t?t(this.art):t;if(this.$parent&&this.name&&!r.disable){var n=r.name||"".concat(this.name).concat(this.id);L(!U(this,n),"Cannot add an existing name [".concat(n,"] to the [").concat(this.name,"]")),this.id+=1;var o=document.createElement("div");m(o,"art-".concat(this.name)),m(o,"art-".concat(this.name,"-").concat(n));var i=Array.from(this.$parent.children);o.dataset.index=r.index||this.id;var a=i.find((function(t){return Number(t.dataset.index)>=Number(o.dataset.index)}));a?a.insertAdjacentElement("beforebegin",o):x(this.$parent,o),r.html&&x(o,r.html),r.style&&k(o,r.style),r.tooltip&&E(o,r.tooltip),r.click&&this.art.events.proxy(o,"click",(function(t){t.preventDefault(),r.click.call(e.art,e,t)})),r.selector&&["left","right"].includes(r.position)&&this.selector(r,o),r.mounted&&r.mounted.call(this.art,o),1===o.childNodes.length&&3===o.childNodes[0].nodeType&&m(o,"art-control-onlyText"),H(this,n,{value:o})}}},{key:"selector",value:function(t,e){var r=this,n=this.art.events,o=n.hover,i=n.proxy;m(e,"art-control-selector");var a=document.createElement("div");m(a,"art-selector-value"),x(a,t.html),e.innerText="",x(e,a);var c=t.selector.map((function(t,e){return'
').concat(t.html,"
")})).join(""),l=document.createElement("div");m(l,"art-selector-list"),x(l,c),x(e,l);var s=function(){var t=j(e,"width")/2-j(l,"width")/2;l.style.left="".concat(t,"px")};o(e,s),i(l,"click",(function(e){var n=(e.composedPath()||[]).find((function(t){return w(t,"art-selector-item")}));if(n){var o=Number(n.dataset.index),i=t.selector[o]||{};if(a.innerText=n.innerText,t.onSelect){var c=t.onSelect.call(r.art,i,n);"string"==typeof c&&(a.innerHTML=c)}s(),r.art.emit("selector",i,n)}}))}}]),e}();function Pt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function St(t){for(var e=1;e
'),mounted:function(t){var r=!1,o=v(".art-progress-loaded",t),c=v(".art-progress-played",t),l=v(".art-progress-highlight",t),s=v(".art-progress-indicator",t),u=v(".art-progress-tip",t);function p(t,e){"loaded"===t&&O(o,"width","".concat(100*e,"%")),"played"===t&&(O(c,"width","".concat(100*e,"%")),O(s,"left","calc(".concat(100*e,"% - ").concat(j(s,"width")/2,"px)")))}n.forEach((function(t){var e=Z(t.time,0,a.duration)/a.duration*100;x(l,''))})),p("loaded",a.loaded),e.on("video:progress",(function(){p("loaded",a.loaded)})),e.on("video:timeupdate",(function(){p("played",a.played)})),e.on("video:ended",(function(){p("played",1)})),i(t,"mousemove",(function(r){O(u,"display","block"),$(r,l)?function(r){var n=Lt(e,r).width,o=r.target.dataset.text;u.innerHTML=o;var i=u.clientWidth;n<=i/2?O(u,"left",0):n>t.clientWidth-i/2?O(u,"left","".concat(t.clientWidth-i,"px")):O(u,"left","".concat(n-i/2,"px"))}(r):function(r){var n=Lt(e,r),o=n.width,i=n.time;u.innerHTML=i;var a=u.clientWidth;o<=a/2?O(u,"left",0):o>t.clientWidth-a/2?O(u,"left","".concat(t.clientWidth-a,"px")):O(u,"left","".concat(o-a/2,"px"))}(r)})),i(t,"mouseout",(function(){O(u,"display","none")})),i(t,"click",(function(t){if(t.target!==s){var r=Lt(e,t),n=r.second;p("played",r.percentage),a.seek=n}})),i(s,"mousedown",(function(){r=!0})),i(document,"mousemove",(function(t){if(r){var n=Lt(e,t),o=n.second,i=n.percentage;m(s,"art-show-indicator"),p("played",i),a.seek=o}})),i(document,"mouseup",(function(){r&&(r=!1,b(s,"art-show-indicator"))}))}})}}function Ft(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function qt(t){for(var e=1;en.clientWidth-l/2?O(t,"left","".concat(n.clientWidth-l,"px")):O(t,"left","".concat(i-l/2,"px"))}(o))})),i(n,"mouseout",(function(){O(t,"display","none")}))}})}}function Qt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Yt(t){for(var e=1;e=3e3&&(r.show=!1,m(c,"art-hide-cursor"),b(c,"art-hover"))})),e.once("ready",(function(){r.add(Mt({name:"progress",disable:i.isLive,position:"top",index:10})),r.add(Xt({name:"thumbnails",disable:!i.thumbnails.url||i.isLive,position:"top",index:20})),r.add(function(t){return function(e){return Kt(Kt({},t),{},{mounted:function(t){var r=e.player,n=x(t,''),o=x(t,'');e.on("loop",(function(e){e?(O(t,"display","block"),O(n,"left","calc(".concat(e[0]/r.duration*100,"% - ").concat(n.clientWidth,"px)")),O(o,"left","".concat(e[1]/r.duration*100,"%"))):O(t,"display","none")}))}})}}({name:"loop",disable:!1,position:"top",index:30})),r.add(function(t){return function(e){return zt(zt({},t),{},{mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.i18n,i=e.player,a=x(t,n.play),c=x(t,n.pause);function l(){O(a,"display","flex"),O(c,"display","none")}function s(){O(a,"display","none"),O(c,"display","flex")}E(a,o.get("Play")),E(c,o.get("Pause")),r(a,"click",(function(){i.play()})),r(c,"click",(function(){i.pause()})),i.playing?s():l(),e.on("video:playing",(function(){s()})),e.on("video:pause",(function(){l()}))}})}}({name:"playAndPause",disable:!1,position:"left",index:10})),r.add(function(t){return function(e){return Wt(Wt({},t),{},{mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.player,i=e.i18n,a=!1,c=x(t,n.volume),l=x(t,n.volumeClose),s=x(t,'
'),u=x(s,'
');function p(t){var e=s.getBoundingClientRect().left;return Z(t.pageX-e-6,0,54)/48}function f(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.7;if(o.muted||0===t)O(c,"display","none"),O(l,"display","flex"),O(u,"left","0");else{var e=48*t;O(c,"display","flex"),O(l,"display","none"),O(u,"left","".concat(e,"px"))}}E(c,i.get("Mute")),O(l,"display","none"),e.isMobile&&O(s,"display","none"),f(o.volume),e.on("video:volumechange",(function(){f(o.volume)})),r(c,"click",(function(){o.muted=!0})),r(l,"click",(function(){o.muted=!1})),r(s,"click",(function(t){o.muted=!1,o.volume=p(t)})),r(u,"mousedown",(function(){a=!0})),r(t,"mousemove",(function(t){a&&(o.muted=!1,o.volume=p(t))})),r(document,"mouseup",(function(){a&&(a=!1)}))}})}}({name:"volume",disable:!1,position:"left",index:20})),r.add(function(t){return function(e){return It(It({},t),{},{mounted:function(t){function r(){var r="".concat(J(e.player.currentTime)," / ").concat(J(e.player.duration));r!==t.innerText&&(t.innerText=r)}r(),["video:loadedmetadata","video:timeupdate","video:progress"].forEach((function(t){e.on(t,r)}))}})}}({name:"time",disable:i.isLive,position:"left",index:30})),r.add(function(t){return function(e){var r=e.option.quality,n=r.find((function(t){return t.default}))||r[0];return Jt(Jt({},t),{},{html:n?n.html:"",selector:r,onSelect:function(t){e.player.switchQuality(t.url,t.html)}})}}({name:"quality",disable:0===i.quality.length,position:"right",index:10})),r.add(function(t){return function(e){return Yt(Yt({},t),{},{tooltip:e.i18n.get("Screenshot"),mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.player;x(t,n.screenshot),r(t,"click",(function(){o.screenshot()}))}})}}({name:"screenshot",disable:!i.screenshot,position:"right",index:20})),r.add(function(t){return function(e){return qt(qt({},t),{},{tooltip:e.i18n.get("Hide subtitle"),mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.i18n,i=e.subtitle;x(t,n.subtitle),r(t,"click",(function(){i.toggle=!0})),e.on("subtitle",(function(e){E(t,o.get(e?"Hide subtitle":"Show subtitle"))}))}})}}({name:"subtitle",disable:!i.subtitle.url,position:"right",index:30})),r.add(function(t){return function(e){return Nt(Nt({},t),{},{tooltip:e.i18n.get("Show setting"),mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.i18n,i=e.setting;x(t,n.setting),r(t,"click",(function(){i.toggle=!0})),e.on("setting",(function(e){E(t,o.get(e?"Hide setting":"Show setting"))}))}})}}({name:"setting",disable:!i.setting,position:"right",index:40})),r.add(function(t){return function(e){return Tt(Tt({},t),{},{tooltip:e.i18n.get("PIP mode"),mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.i18n,i=e.player;x(t,n.pip),r(t,"click",(function(){i.pipToggle=!0})),e.on("pip",(function(e){E(t,o.get(e?"Exit PIP mode":"PIP mode"))}))}})}}({name:"pip",disable:!i.pip,position:"right",index:50})),r.add(function(t){return function(e){return Rt(Rt({},t),{},{tooltip:e.i18n.get("Web fullscreen"),mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.i18n,i=e.player;x(t,n.fullscreenWeb),r(t,"click",(function(){i.fullscreenWebToggle=!0})),e.on("fullscreenWeb",(function(e){E(t,o.get(e?"Exit web fullscreen":"Web fullscreen"))}))}})}}({name:"fullscreenWeb",disable:!i.fullscreenWeb,position:"right",index:60})),r.add(function(t){return function(e){return St(St({},t),{},{tooltip:e.i18n.get("Fullscreen"),mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.i18n,i=e.player;x(t,n.fullscreen),r(t,"click",(function(){i.fullscreenToggle=!0})),e.on("fullscreen",(function(e){E(t,o.get(e?"Exit fullscreen":"Fullscreen"))}))}})}}({name:"fullscreen",disable:!i.fullscreen,position:"right",index:70})),i.controls.forEach((function(t){r.add(t)}))})),r}return r(o,[{key:"add",value:function(t){var e="function"==typeof t?t(this.art):t,r=this.art.template,n=r.$progress,i=r.$controlsLeft,a=r.$controlsRight;switch(e.position){case"top":this.$parent=n;break;case"left":this.$parent=i;break;case"right":this.$parent=a;break;default:L(!1,"Control option.position must one of 'top', 'left', 'right'")}kt(l(o.prototype),"add",this).call(this,e)}}]),o}(jt);function re(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ne(t){for(var e=1;e0.50.75').concat(r.get("Normal"),'1.251.52.0'),click:function(t,e){var r=e.target.dataset.rate;r&&(n.playbackRate=Number(r),t.show=!1)},mounted:function(t){e.on("playbackRate",(function(e){var r=g("span",t).find((function(t){return Number(t.dataset.rate)===e}));r&&S(r,"art-current")}))}})}}({disable:!i.playbackRate,name:"playbackRate",index:10})),o.add(function(t){return function(e){var r=e.i18n,n=e.player;return ie(ie({},t),{},{html:"".concat(r.get("Aspect ratio"),':').concat(r.get("Default"),'4:316:9'),click:function(t,e){var r=e.target.dataset.ratio;r&&(n.aspectRatio=r,t.show=!1)},mounted:function(t){e.on("aspectRatio",(function(e){var r=g("span",t).find((function(t){return t.dataset.ratio===e}));r&&S(r,"art-current")}))}})}}({disable:!i.aspectRatio,name:"aspectRatio",index:20})),o.add(function(t){return function(e){return ce(ce({},t),{},{html:e.i18n.get("Video info"),click:function(t){e.info.show=!0,t.show=!1}})}}({disable:!1,name:"info",index:30})),o.add(function(t){return se(se({},t),{},{html:'ArtPlayer 4.0.0'})}({disable:!1,name:"version",index:40})),o.add(function(t){return function(e){return pe(pe({},t),{},{html:e.i18n.get("Close"),click:function(t){t.show=!1}})}}({disable:!1,name:"close",index:60})),i.contextmenu.forEach((function(t){o.add(t)})),s(c,"contextmenu",(function(t){t.preventDefault(),o.show=!0;var e=t.clientX,r=t.clientY,n=c.getBoundingClientRect(),i=n.height,a=n.width,s=n.left,u=n.top,p=l.getBoundingClientRect(),f=p.height,d=p.width,h=e-s,y=r-u;e+d>s+a&&(h=a-d),r+f>u+i&&(y=i-f),k(l,{top:"".concat(y,"px"),left:"".concat(h,"px")})})),s(c,"click",(function(t){$(t,l)||(o.show=!1)})),e.on("blur",(function(){o.show=!1}))})),o}return n}(jt);function he(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l(t);if(e){var o=l(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var ye=function(e){i(o,e);var n=he(o);function o(e){var r;return t(this,o),(r=n.call(this,e)).art=e,r.name="info",r.art.template.$info&&r.init(),r}return r(o,[{key:"init",value:function(){var t=this,e=this.art,r=e.template,n=r.$infoPanel,o=r.$infoClose,i=r.$video;(0,e.events.proxy)(o,"click",(function(){t.show=!1}));var a=null,c=g("[data-video]",n);function l(){c.forEach((function(t){var e=i[t.dataset.video];t.innerText="number"==typeof e?e.toFixed(2):e})),a=setTimeout((function(){l()}),1e3)}this.art.on("destroy",(function(){clearTimeout(a)})),this.art.on("info",(function(t){clearTimeout(a),t&&l()}))}}]),o}(jt);function ve(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l(t);if(e){var o=l(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var ge=function(e){i(o,e);var n=ve(o);function o(e){var r;t(this,o),(r=n.call(this,e)).name="subtitle";var i=e.option.subtitle,a=e.template.$subtitle;return k(a,i.style),i.url&&r.init(i.url),i.bilingual&&m(a,"art-bilingual"),r}return r(o,[{key:"url",get:function(){return this.art.template.$track.src}},{key:"textTrack",get:function(){return this.art.template.$video.textTracks[0]}},{key:"activeCue",get:function(){return this.textTrack.activeCues[0]}},{key:"bilingual",get:function(){return w(this.art.template.$subtitle,"art-bilingual")},set:function(t){var e=this.art.template.$subtitle;t?m(e,"art-bilingual"):b(e,"art-bilingual")}},{key:"style",value:function(t,e){var r=this.art.template.$subtitle;return"object"===a(t)?k(r,t):O(r,t,e)}},{key:"update",value:function(){var t=this.art.template.$subtitle;t.innerHTML="",this.activeCue&&(t.innerHTML=this.activeCue.text.split(/\r?\n/).map((function(t){return"

".concat(G(t),"

")})).join(""),this.art.emit("subtitleUpdate",this.activeCue.text))}},{key:"switch",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.art,o=n.i18n,i=n.notice;return this.init(t,r).then((function(t){return r.name&&(i.show="".concat(o.get("Switch subtitle"),": ").concat(r.name)),e.art.emit("subtitleSwitch",t),t}))}},{key:"init",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.art,o=n.notice,i=n.events.proxy,a=n.option.subtitle,c=n.template,l=c.$subtitle,s=c.$video,u=c.$track;if(!u){var p=document.createElement("track");p.default=!0,p.kind="metadata",s.appendChild(p),this.art.template.$track=p,i(this.textTrack,"cuechange",this.update.bind(this))}return fetch(t).then((function(t){return t.arrayBuffer()})).then((function(n){var o=new TextDecoder(r.encoding||a.encoding).decode(n);switch(e.art.emit("subtitleLoad",t),r.ext||B(t)){case"srt":return F(M(o));case"ass":return F(q(o));case"vtt":return F(o);default:return t}})).then((function(t){return l.innerHTML="",e.url===t||(URL.revokeObjectURL(e.url),e.art.template.$track.src=t),t})).catch((function(t){throw o.show=t,t}))}}]),o}(jt);var me=function(){function e(r){var n=this;t(this,e),this.destroyEvents=[],this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),this.loadImg=this.loadImg.bind(this),r.whitelist.state&&r.once("ready",(function(){!function(t,e){var r=t.template.$player;e.proxy(document,["click","contextmenu"],(function(e){$(e,r)?(t.isFocus=!0,t.emit("focus")):(t.isFocus=!1,t.emit("blur"))}))}(r,n),function(t,e){var r=t.template.$player;e.hover(r,(function(){m(r,"art-hover"),t.emit("hover",!0)}),(function(){b(r,"art-hover"),t.emit("hover")}))}(r,n),function(t,e){var r=t.template.$player;e.proxy(r,"mousemove",(function(e){t.emit("mousemove",e)}))}(r,n),function(t,e){var r=t.option,n=t.player,o=Y((function(){n.normalSize&&(n.autoSize=r.autoSize),n.aspectRatioReset=!0,t.emit("resize")}),500);e.proxy(window,["orientationchange","resize"],(function(){o()}))}(r,n),function(t,e){if(t.isMobile&&!t.option.isLive){var r=t.player,n=t.notice,o=t.template.$video,i=!1,a=0,c=0;e.proxy(o,"touchstart",(function(t){1===t.touches.length&&(i=!0,a=t.touches[0].clientX)})),e.proxy(document,"touchmove",(function(t){if(1===t.touches.length&&i){var e=Z((t.touches[0].clientX-a)/o.clientWidth,-1,1);c=Z(r.currentTime+60*e,0,r.duration),n.show="".concat(J(c)," / ").concat(J(r.duration))}})),e.proxy(document,"touchend",(function(){i&&c&&(r.seek=c),i=!1,a=0,c=0}))}}(r,n),function(t,e){var r=t.player,n=t.option,o=t.template.$container,i=Y((function(){t.emit("view",R(o,50))}),200);e.proxy(window,"scroll",(function(){i()})),t.on("view",(function(t){n.autoMini&&(r.mini=!t)}))}(r,n)}))}return r(e,[{key:"proxy",value:function(t,e,r){var n=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(Array.isArray(e))return e.map((function(e){return n.proxy(t,e,r,o)}));t.addEventListener(e,r,o);var i=function(){return t.removeEventListener(e,r,o)};return this.destroyEvents.push(i),i}},{key:"hover",value:function(t,e,r){e&&this.proxy(t,"mouseenter",e),r&&this.proxy(t,"mouseleave",r)}},{key:"loadImg",value:function(t){var e=this;return new Promise((function(r,n){var o;if(t instanceof HTMLImageElement)o=t;else{if("string"!=typeof t)return n(new C("Unable to get Image"));(o=new Image).src=t}return o.complete||(e.proxy(o,"load",(function(){return r(o)})),e.proxy(o,"error",(function(){return n(new C("Failed to load Image: ".concat(o.src)))}))),r(o)}))}},{key:"destroy",value:function(){this.destroyEvents.forEach((function(t){return t()}))}}]),e}(),be=function(){function e(r){var n=this;t(this,e),this.keys={};var o=r.option,i=r.player,a=r.events.proxy;o.hotkey&&r.once("ready",(function(){n.add(27,(function(){i.fullscreenWeb&&(i.fullscreenWeb=!1)})),n.add(32,(function(){i.toggle()})),n.add(37,(function(){i.backward=5})),n.add(38,(function(){i.volume+=.1})),n.add(39,(function(){i.forward=5})),n.add(40,(function(){i.volume-=.1})),a(window,"keydown",(function(t){if(r.isFocus){var e=document.activeElement.tagName.toUpperCase(),o=document.activeElement.getAttribute("contenteditable");if("INPUT"!==e&&"TEXTAREA"!==e&&""!==o&&"true"!==o){var i=n.keys[t.keyCode];i&&(t.preventDefault(),i.forEach((function(t){return t.call(r)})),r.emit("hotkey",t))}}}))}))}return r(e,[{key:"add",value:function(t,e){this.keys[t]?this.keys[t].push(e):this.keys[t]=[e]}}]),e}();function we(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l(t);if(e){var o=l(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var xe=function(e){i(n,e);var r=we(n);function n(e){var o;return t(this,n),(o=r.call(this,e)).name="layer",o.$parent=e.template.$layer,e.once("ready",(function(){e.option.layers.forEach((function(t){o.add(t)}))})),o}return n}(jt);function Oe(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l(t);if(e){var o=l(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var ke=function(e){i(n,e);var r=Oe(n);function n(e){var o;return t(this,n),(o=r.call(this,e)).name="loading",x(e.template.$loading,e.icons.loading),o}return n}(jt),je=function(){function e(r){t(this,e),this.art=r,this.time=2e3,this.timer=null}return r(e,[{key:"show",set:function(t){var e=this.art.template,r=e.$player,n=e.$noticeInner;if(!t)return b(r,"art-notice-show");n.innerText=t instanceof Error?t.message.trim():t,m(r,"art-notice-show"),clearTimeout(this.timer),this.timer=setTimeout((function(){n.innerText="",b(r,"art-notice-show")}),this.time)}}]),e}();function Pe(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l(t);if(e){var o=l(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var Se=function(e){i(n,e);var r=Pe(n);function n(e){var o;return t(this,n),(o=r.call(this,e)).name="mask",x(e.template.$state,e.icons.state),o}return n}(jt);function Ee(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}var Re=function e(r){var n=this;t(this,e);var o=function(t){for(var e=1;e',state:'',play:'',pause:'',volume:'',volumeClose:'',subtitle:'',screenshot:'\t',setting:'',fullscreen:'\t\t\t\t',fullscreenWeb:'\t',pip:''},r.option.icons);Object.keys(o).forEach((function(t){H(n,t,{get:function(){var e=document.createElement("i");return m(e,"art-icon"),m(e,"art-icon-".concat(t)),x(e,o[t]),e}})}))};function $e(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Te(t){for(var e=1;e'.concat(r.get("Flip"),'
"),click:function(t,e){var r=e.target.dataset.value;r&&(n.flip=r)},mounted:function(t){e.on("flip",(function(e){var r=g("button",t).find((function(t){return t.dataset.value===e}));r&&S(r.parentElement,"current")}))}})}}({disable:!i.flip,name:"flip"})),o.add(function(t){return function(e){var r=e.i18n,n=e.player;return ze(ze({},t),{},{html:'
'.concat(r.get("Rotate"),': 0°
'),click:function(t,e){var r=e.target.dataset.value;if(r){var o=n.rotate+Number(r);n.rotate=360===o||-360===o?0:o}else n.rotate=0},mounted:function(t){var r=v(".art-rotate-value",t);e.on("rotate",(function(t){r.innerText="".concat(t||0,"°")}))}})}}({disable:!i.rotate,name:"rotate"})),o.add(function(t){return function(e){var r=e.i18n,n=e.player;return Ce(Ce({},t),{},{html:'
'.concat(r.get("Aspect ratio"),'
'),click:function(t,e){var r=e.target.dataset.value;r&&(n.aspectRatio=r)},mounted:function(t){e.on("aspectRatio",(function(e){var r=g("button",t).find((function(t){return t.dataset.value===e}));r&&S(r.parentElement,"current")}))}})}}({disable:!i.aspectRatio,name:"aspectRatio"})),o.add(function(t){return function(e){var r=e.i18n,n=e.player,o=e.events.proxy;return Me(Me({},t),{},{html:'
'.concat(r.get("Play speed"),': 1.0x
'),mounted:function(t){var r=v(".art-setting-range input",t),i=v(".art-subtitle-value",t);o(r,"change",(function(){var t=r.value;i.innerText=t,n.playbackRate=Number(t)})),e.on("playbackRate",(function(t){t&&r.value!==t&&(r.value=t,i.innerText=t)}))}})}}({disable:!i.playbackRate,name:"playbackRate"}))})),e.on("blur",(function(){o.show=!1}))),o}return n}(jt),Be=function(){function e(){t(this,e),this.name="artplayer_settings",this.settings={}}return r(e,[{key:"get",value:function(t){try{var e=JSON.parse(window.localStorage.getItem(this.name))||{};return t?e[t]:e}catch(e){return t?this.settings[t]:this.settings}}},{key:"set",value:function(t,e){try{var r=Object.assign({},this.get(),tt({},t,e));window.localStorage.setItem(this.name,JSON.stringify(r))}catch(r){this.settings[t]=e}}},{key:"del",value:function(t){try{var e=this.get();delete e[t],window.localStorage.setItem(this.name,JSON.stringify(e))}catch(e){delete this.settings[t]}}},{key:"clean",value:function(){try{window.localStorage.removeItem(this.name)}catch(t){this.settings={}}}}]),e}();function Ie(t){var e=t.i18n,r=t.subtitle,n=t.events.proxy;return{title:"Subtitle",name:"subtitleOffset",index:20,html:'
'.concat(e.get("Subtitle offset time"),': 0s
'),mounted:function(e){var o=v(".art-setting-range input",e),i=v(".art-subtitle-value",e);n(o,"change",(function(){var e=o.value;i.innerText=e,t.plugins.subtitleOffset.offset(Number(e))})),t.on("subtitle:switch",(function(){o.value=0,i.innerText=0})),t.on("subtitleOffset",(function(t){r.update(),o.value!==t&&(o.value=t,i.innerText=t)}))}}}function Ve(t){var e=t.constructor.utils.clamp,r=t.setting,n=t.notice,o=t.template,i=t.i18n,a=t.player;r.add(Ie);var c=[];return t.on("subtitle:switch",(function(){c=[]})),{name:"subtitleOffset",offset:function(r){if(o.$track&&o.$track.track){var l=Array.from(o.$track.track.cues),s=e(r,-5,5);l.forEach((function(t,r){c[r]||(c[r]={startTime:t.startTime,endTime:t.endTime}),t.startTime=e(c[r].startTime+s,0,a.duration),t.endTime=e(c[r].endTime+s,0,a.duration)})),n.show="".concat(i.get("Subtitle offset time"),": ").concat(r,"s"),t.emit("subtitleOffset",r)}else n.show="".concat(i.get("No subtitles found")),t.emit("subtitleOffset",0)}}}function We(t){var e=t.events.proxy,r=t.template,n=t.player,o=t.option,i=t.setting,a=t.i18n;function c(e){if(e){var i=r.$video.canPlayType(e.type);if("maybe"===i||"probably"===i){var a=URL.createObjectURL(e);o.title=e.name,n.switchUrl(a,e.name),t.emit("localVideo",e)}else L(!1,"Playback of this file format is not supported")}}function l(t){var r=x(t,'');O(t,"position","relative"),k(r,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(r,"change",(function(){c(r.files[0])}))}return e(r.$player,"dragover",(function(t){t.preventDefault()})),e(r.$player,"drop",(function(t){t.preventDefault(),c(t.dataTransfer.files[0])})),t.once("ready",(function(){i.add({title:"Local Video",name:"localVideo",index:30,html:'
'.concat(a.get("Local Video"),'
').concat(a.get("Open"),'
'),mounted:function(e){var r=v(".art-upload-btn",e),n=v(".art-upload-value",e);t.on("localVideo",(function(t){n.textContent=t.name,n.title=t.name})),l(r)}})})),{name:"localVideo",attach:l}}function He(t){var e=t.events.proxy,r=t.subtitle,n=t.setting,o=t.i18n;function i(n){var o=x(n,'');O(n,"position","relative"),k(o,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(o,"change",(function(){!function(e){if(e){var n=B(e.name);["ass","vtt","srt"].includes(n)?(r.switch(URL.createObjectURL(e),{name:e.name,ext:n}),t.emit("localSubtitle",e)):L(!1,"Only supports subtitle files in .ass, .vtt and .srt format")}}(o.files[0])}))}return t.once("ready",(function(){n.add({title:"Local Subtitle",name:"localSubtitle",index:40,html:'
'.concat(o.get("Local Subtitle"),'
').concat(o.get("Open"),'
'),mounted:function(e){var r=v(".art-upload-btn",e),n=v(".art-upload-value",e);t.on("localSubtitle",(function(t){n.textContent=t.name,n.title=t.name})),i(r)}})})),{name:"localSubtitle",attach:i}}function Ne(t){var e=t.layers,r=t.player,n=t.option.theme;return e.add({name:"miniProgressBar",style:{display:"none",position:"absolute",left:0,right:0,bottom:0,height:"2px",background:n},mounted:function(e){t.on("control",(function(t){e.style.display=t?"none":"block"})),t.on("destroy",(function(){e.style.display="none"})),t.on("video:timeupdate",(function(){e.style.width="".concat(100*r.played,"%")}))}}),{name:"miniProgressBar"}}var Ue=function(){function e(r){var n=this;t(this,e),this.art=r,this.id=0;var o=r.option;o.subtitle.url&&o.subtitleOffset&&this.add(Ve),!o.isLive&&o.miniProgressBar&&this.add(Ne),o.localVideo&&this.add(We),o.localSubtitle&&this.add(He),r.option.plugins.forEach((function(t){n.add(t)}))}return r(e,[{key:"add",value:function(t){this.id+=1;var e=t.call(this,this.art),r=e&&e.name||t.name||"plugin".concat(this.id);return L(!U(this,r),"Cannot add a plugin that already has the same name: ".concat(r)),H(this,r,{value:e}),this}}]),e}(),_e=function e(r){t(this,e);var n=r.option,o=r.events.proxy,i=r.template.$video;pt.events.forEach((function(t){o(i,t,(function(t){r.emit("video:".concat(t.type),t)}))})),Object.keys(n.moreVideoAttr).forEach((function(t){i[t]=n.moreVideoAttr[t]})),n.muted&&(i.muted=n.muted),n.volume&&(i.volume=Z(n.volume,0,1)),n.poster&&(i.poster=n.poster),n.autoplay&&(i.autoplay=n.autoplay),i.controls=!0;var a=n.type||B(n.url),c=n.customType[a];a&&c?(c(i,n.url,r),r.emit("customType",a)):(i.src=n.url,r.emit("url",i.src))};function Xe(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l(t);if(e){var o=l(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var Qe=0,Ye=[],Ze=function(e){i(a,e);var o=Xe(a);function a(e){var r;return t(this,a),(r=o.call(this)).option=u(X(a.option,e),ut),r.isFocus=!1,r.isDestroy=!1,r.userAgent=f,r.isMobile=d,r.isWechat=y,r.whitelist=new ft(n(r)),r.template=new dt(n(r)),r.events=new me(n(r)),r.whitelist.state?(r.storage=new Be(n(r)),r.icons=new Re(n(r)),r.i18n=new vt(n(r)),r.notice=new je(n(r)),r.player=new xt(n(r)),r.layers=new xe(n(r)),r.controls=new ee(n(r)),r.contextmenu=new de(n(r)),r.subtitle=new ge(n(r)),r.info=new ye(n(r)),r.loading=new ke(n(r)),r.hotkey=new be(n(r)),r.mask=new Se(n(r)),r.setting=new qe(n(r)),r.plugins=new Ue(n(r))):r.mobile=new _e(n(r)),Qe+=1,r.id=Qe,Ye.push(n(r)),r}return r(a,[{key:"destroy",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.events.destroy(),this.template.destroy(t),Ye.splice(Ye.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}],[{key:"instances",get:function(){return Ye}},{key:"version",get:function(){return"4.0.0"}},{key:"env",get:function(){return'"production"'}},{key:"config",get:function(){return pt}},{key:"utils",get:function(){return K}},{key:"scheme",get:function(){return ut}},{key:"Emitter",get:function(){return p}},{key:"validator",get:function(){return u}},{key:"kindOf",get:function(){return u.kindOf}},{key:"html",get:function(){return dt.html}},{key:"option",get:function(){return{container:"#artplayer",url:"",poster:"",title:"",type:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,autoMini:!1,loop:!1,flip:!1,rotate:!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,localVideo:!1,localSubtitle:!1,networkMonitor:!1,useSSR:!1,layers:[],contextmenu:[],controls:[],quality:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,width:160,height:90,column:10},subtitle:{url:"",style:{},encoding:"utf-8",bilingual:!1},moreVideoAttr:{controls:!1,preload:h?"auto":"metadata"},icons:{},customType:{},lang:navigator.language.toLowerCase()}}}]),a}(p);return console.log("%c ArtPlayer %c 4.0.0 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),Ze})); diff --git a/packages/artplayer-document/docs/en/Class.md b/packages/artplayer-document/docs/en/Class.md index 9ae4a13b4..3bf09006e 100644 --- a/packages/artplayer-document/docs/en/Class.md +++ b/packages/artplayer-document/docs/en/Class.md @@ -1,20 +1,20 @@ --- -title: 静态属性 +title: Static property sidebar_position: 5 slug: /class --- -:::tip 提示 +:::tip Tip -静态属性存在于构造函数 `Artplayer` 上,和播放器实例没有直接关联 +Static attributes exist in the constructor artplayer, and the player instance is not directly associated ::: ## instances -- 类型: `Array` +- Type: `Array` -一个保存了所有播放器实例的数组,当单个页面同时存在多个播放器时,可以通过这个属性进行管理多个实例 +A array that saves all player instances, and can manage multiple instances through this property when multiple players exist at the same time.
▶ Run Code
@@ -25,111 +25,111 @@ var art = new Artplayer({ }); art.on('ready', () => { - console.info(Artplayer.instances.length) -}) + console.info(Artplayer.instances.length); +}); ``` ## version -- 类型: `String` +- Type: `String` -当前播放器版本号 +Current player version number
▶ Run Code
```js -console.info(Artplayer.version) +console.info(Artplayer.version); ``` ## env -- 类型: `String` +- Type: `String` -当前播放器环境变量 +Current player environment variable
▶ Run Code
```js -console.info(Artplayer.env) +console.info(Artplayer.env); ``` ## utils -- 类型: `Object` +- Type: `Object` -播放器的常用工具集 +Common utils for player
▶ Run Code
```js -console.info(Object.keys(Artplayer.utils)) +console.info(Object.keys(Artplayer.utils)); ``` ## config -- 类型: `Object` +- Type: `Object` -存放了播放器的原生属性和方法 +Store native properties and methods of video
▶ Run Code
```js -console.info(Artplayer.config) +console.info(Artplayer.config); ``` ## scheme -- 类型: `Object` +- Type: `Object` -播放器参数的校验方案 +Verification scheme for player option
▶ Run Code
```js -console.info(Artplayer.scheme) +console.info(Artplayer.scheme); ``` ## validator -- 类型: `Function` +- Type: `Function` -播放器参数的校验器 +Validator for player option ## option -- 类型: `Object` +- Type: `Object` -播放器默认参数 +Player default option
▶ Run Code
```js -console.info(Artplayer.option) +console.info(Artplayer.option); ``` ## html -- 类型: `String` +- Type: `String` -播放器默认 `Html` 字符串,通常用于 `SSR` 的提前渲染,更多信息请访问 [配合SSR使用](/document/zh-cn/Questions/ssr) +Player defaults `HTML` String, usually used for `SSR`
▶ Run Code
```js -console.info(Artplayer.html) +console.info(Artplayer.html); ``` ## kindOf -- 类型: `Function` +- Type: `Function` -JS类型识别函数 +JS type identification function
▶ Run Code
```js -console.info(Artplayer.kindOf('0')) -console.info(Artplayer.kindOf(0)) -console.info(Artplayer.kindOf({})) -console.info(Artplayer.kindOf([])) -``` \ No newline at end of file +console.info(Artplayer.kindOf('0')); +console.info(Artplayer.kindOf(0)); +console.info(Artplayer.kindOf({})); +console.info(Artplayer.kindOf([])); +``` diff --git a/packages/artplayer-document/docs/en/Events.mdx b/packages/artplayer-document/docs/en/Events.mdx index 970efc1c1..c171719e1 100644 --- a/packages/artplayer-document/docs/en/Events.mdx +++ b/packages/artplayer-document/docs/en/Events.mdx @@ -1,16 +1,16 @@ --- -title: 实例事件 +title: Common events sidebar_position: 6 slug: /events --- -播放器的事件分为两种,一种视频的原生事件,另外一种是自定义的事件。原生事件来自 `video` 元素,是直接监听`video`元素的原始事件,为了让它和自定义事件区分,原生事件添加了前缀 `video:` +The event of the player is divided into two, a `native event` of a video, and another is a `custom event`. The `native event` comes from `Video Elements`, is the original event of the `Video Element`, in order to distinguish it and `custom events`, the native event adds a prefix `video:` -## 原生事件 +## Native event -更多信息请阅读 [Mozilla Video Events](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video#events) +For more information, please read [Mozilla Video Events](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video#events) -| 事件名字 | 触发时间 | +| Event name | Fired When | | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `video:canplay` | The browser can play the media, but estimates that not enough data has been loaded to play the media up to its end without having to stop for further buffering of content. | | `video:canplaythrough` | The browser estimates it can play the media up to its end without stopping for content buffering. | @@ -33,11 +33,24 @@ slug: /events | `video:volumechange` | The volume has changed. | | `video:waiting` | Playback has stopped because of a temporary lack of data | -## 自定义事件 +
▶ Run Code
+ +```js +var art = new Artplayer({ + container: '.artplayer-app', + url: '/assets/sample/video.mp4', +}); + +art.on('video:play', (...args) => { + console.info(args); +}); +``` + +## Custom event ### ready -当实例初始化完成,并视频可以被播放时触发,只会触发一个,哪怕视频地址变化了 +Fired when the player is initialized, and the video can be played
▶ Run Code
@@ -54,7 +67,7 @@ art.on('ready', (...args) => { ### play -在视频被播放后触发 +Fired after the video is played
▶ Run Code
@@ -71,7 +84,7 @@ art.on('play', (...args) => { ### pause -在视频被暂停后触发 +Fired after the video is pause
▶ Run Code
@@ -88,7 +101,7 @@ art.on('pause', (...args) => { ### seek -在视频进行时间跳转时触发 +Fired when the video is time jump
▶ Run Code
@@ -107,9 +120,15 @@ art.on('ready', (...args) => { }); ``` +:::tip Tip + +Set the `art.currentTime` will not fired the `seek` event + +::: + ### volume -在视频音量变化时触发 +Fired when the video volume changes
▶ Run Code
@@ -130,7 +149,7 @@ art.on('ready', (...args) => { ### destroy -在播放器实例被销毁时触发 +Fired when the player instance is destroyed
▶ Run Code
@@ -151,7 +170,7 @@ art.on('ready', (...args) => { ### focus -在播放器获得焦点时触发,如点击了播放器 +Fired when the player gets focus, if you click on the player
▶ Run Code
@@ -168,7 +187,7 @@ art.on('focus', (...args) => { ### blur -在播放器失去焦点时触发,如点击播放器以外的区域 +Fired when the player loses focus, such as the area other than the player
▶ Run Code
@@ -185,7 +204,7 @@ art.on('blur', (...args) => { ### hover -在鼠标移动进播放器时触发 +Fired when mouse moves player
▶ Run Code
@@ -195,14 +214,16 @@ var art = new Artplayer({ url: '/assets/sample/video.mp4', }); -art.on('hover', (...args) => { - console.info(args); +art.on('hover', (state) => { + // state for true, the mouse moves from the outside to the player + // state for false, the mouse moves from the player to the outside + console.info(state); }); ``` ### resize -在播放器尺寸变化时触发 +Fired when the player is changed
▶ Run Code
@@ -220,7 +241,7 @@ art.on('resize', (...args) => { ### mousemove -在鼠标经过播放器时触发,和`hover`不一样,它会触发多次 +Fired when the mouse is played, this and `hover` is different, it will trigger multiple times
▶ Run Code
@@ -237,7 +258,7 @@ art.on('mousemove', (...args) => { ### url -在视频地址变化时触发 +Fired when the video url changes
▶ Run Code
@@ -258,7 +279,7 @@ art.on('ready', (...args) => { ### fullscreen -在播放器窗口全屏时触发 +Fired when the player window is full screen
▶ Run Code
@@ -276,7 +297,7 @@ art.on('fullscreen', (...args) => { ### fullscreenWeb -在播放器网页全屏时触发 +Fired when player webpage full screen
▶ Run Code
@@ -294,7 +315,7 @@ art.on('fullscreenWeb', (...args) => { ### hotkey -在快捷键被使用时触发 +Trigger when hotkey are used
▶ Run Code
diff --git a/packages/artplayer-document/docs/en/Libraries.md b/packages/artplayer-document/docs/en/Libraries.md index 8f5104c22..88af165d7 100644 --- a/packages/artplayer-document/docs/en/Libraries.md +++ b/packages/artplayer-document/docs/en/Libraries.md @@ -1,12 +1,12 @@ --- -title: 第三方库 +title: Third party library sidebar_position: 7 slug: /libraries --- ## flv.js -- 主页: [https://github.com/Bilibili/flv.js](https://github.com/Bilibili/flv.js) +- Homepage: [https://github.com/Bilibili/flv.js](https://github.com/Bilibili/flv.js)
▶ Run Code
@@ -30,7 +30,7 @@ var art = new Artplayer({ ## hls.js -- 主页: [https://github.com/video-dev/hls.js](https://github.com/video-dev/hls.js) +- Homepage: [https://github.com/video-dev/hls.js](https://github.com/video-dev/hls.js)
▶ Run Code
@@ -51,7 +51,7 @@ var art = new Artplayer({ ## dash.js -- 主页: [https://github.com/Dash-Industry-Forum/dash.js](https://github.com/Dash-Industry-Forum/dash.js) +- Homepage: [https://github.com/Dash-Industry-Forum/dash.js](https://github.com/Dash-Industry-Forum/dash.js)
▶ Run Code
@@ -71,7 +71,7 @@ var art = new Artplayer({ ## shaka-player -- 主页: [https://github.com/google/shaka-player](https://github.com/google/shaka-player) +- Homepage: [https://github.com/google/shaka-player](https://github.com/google/shaka-player)
▶ Run Code
@@ -92,7 +92,7 @@ var art = new Artplayer({ ## webtorrent -- 主页: [https://github.com/webtorrent/webtorrent](https://github.com/webtorrent/webtorrent) +- Homepage: [https://github.com/webtorrent/webtorrent](https://github.com/webtorrent/webtorrent)
▶ Run Code
diff --git a/packages/artplayer-document/docs/en/Questions/Create button in the controls.md b/packages/artplayer-document/docs/en/Questions/Create button in the controls.md index 742cc79b8..a36261c83 100644 --- a/packages/artplayer-document/docs/en/Questions/Create button in the controls.md +++ b/packages/artplayer-document/docs/en/Questions/Create button in the controls.md @@ -1,10 +1,8 @@ --- -title: 在控制栏添加按钮 +title: Add button to the controls sidebar_position: 2 --- -有时你需要在控制栏添加按钮,如开关按钮或者单选按钮等等,你甚至可以使用第三方的样式库如 `bootstrap` -
▶ Run Code
```js @@ -17,7 +15,7 @@ var art = new Artplayer({ position: 'right', html: '', click: function (_, event) { - // 第二个参数是事件对象 + // The second parameter is an event object time += 1; event.target.innerText = 'You Click ' + time; }, diff --git a/packages/artplayer-document/docs/en/Questions/Create selector in the controls.md b/packages/artplayer-document/docs/en/Questions/Create selector in the controls.md index 25c4ff083..2c2265512 100644 --- a/packages/artplayer-document/docs/en/Questions/Create selector in the controls.md +++ b/packages/artplayer-document/docs/en/Questions/Create selector in the controls.md @@ -1,9 +1,9 @@ --- -title: 在控制栏添加列表 +title: Add a list in the controls sidebar_position: 1 --- -有时你需要在控制栏添加列表,那么你可以在添加控件的时候使用 `selector` 和 `onSelect` 属性 +Sometimes you need to add a list in the controls, then you can use the `selector` and `onSelect` attribute when adding controls
▶ Run Code
@@ -30,7 +30,7 @@ var art = new Artplayer({ name: $dom.innerText, }); - return '你点击了' + item.html; + return 'You click' + item.html; }, }, ], diff --git a/packages/artplayer-document/docs/en/Questions/_category_.json b/packages/artplayer-document/docs/en/Questions/_category_.json index 278c94e5c..7680db0ee 100644 --- a/packages/artplayer-document/docs/en/Questions/_category_.json +++ b/packages/artplayer-document/docs/en/Questions/_category_.json @@ -1,5 +1,5 @@ { - "label": "常见问题", + "label": "Common problem", "position": 7, "collapsed": true } diff --git a/packages/artplayer-document/docs/zh-cn/Class.md b/packages/artplayer-document/docs/zh-cn/Class.md index c1b614b09..2aa9f8051 100644 --- a/packages/artplayer-document/docs/zh-cn/Class.md +++ b/packages/artplayer-document/docs/zh-cn/Class.md @@ -69,7 +69,7 @@ console.info(Object.keys(Artplayer.utils)) - 类型: `Object` -存放了播放器的原生属性和方法 +存放了视频的原生属性和方法
▶ Run Code
@@ -111,7 +111,7 @@ console.info(Artplayer.option) - 类型: `String` -播放器默认 `Html` 字符串,通常用于 `SSR` 的提前渲染,更多信息请访问 [配合SSR使用](/document/zh-cn/Questions/ssr) +播放器默认 `Html` 字符串,通常用于 `SSR` 的提前渲染
▶ Run Code
diff --git a/packages/artplayer-document/docs/zh-cn/Events.mdx b/packages/artplayer-document/docs/zh-cn/Events.mdx index 53d9213a0..50baf3269 100644 --- a/packages/artplayer-document/docs/zh-cn/Events.mdx +++ b/packages/artplayer-document/docs/zh-cn/Events.mdx @@ -33,6 +33,19 @@ slug: /zh-cn/events | `video:volumechange` | The volume has changed. | | `video:waiting` | Playback has stopped because of a temporary lack of data | +
▶ Run Code
+ +```js +var art = new Artplayer({ + container: '.artplayer-app', + url: '/assets/sample/video.mp4', +}); + +art.on('video:play', (...args) => { + console.info(args); +}); +``` + ## 自定义事件 ### ready @@ -107,6 +120,12 @@ art.on('ready', (...args) => { }); ``` +:::tip 提示 + +设置 `art.currentTime` 时不会触发 `seek` 事件 + +::: + ### volume 在视频音量变化时触发 @@ -195,8 +214,10 @@ var art = new Artplayer({ url: '/assets/sample/video.mp4', }); -art.on('hover', (...args) => { - console.info(args); +art.on('hover', (state) => { + // state 为true时,鼠标从外面移进播放器 + // state 为false时,鼠标从播放器移出外面 + console.info(state); }); ``` diff --git a/packages/artplayer-plugin-backlight/dist/artplayer-plugin-backlight.js b/packages/artplayer-plugin-backlight/dist/artplayer-plugin-backlight.js index 99b9c1bd0..1a026168f 100644 --- a/packages/artplayer-plugin-backlight/dist/artplayer-plugin-backlight.js +++ b/packages/artplayer-plugin-backlight/dist/artplayer-plugin-backlight.js @@ -1,8 +1,8 @@ /*! - * artplayer-plugin-backlight.js v3.5.31 + * artplayer-plugin-backlight.js v4.0.0 * Github: https://github.com/zhw2590582/ArtPlayer#readme * (c) 2017-2021 Harvey Zack * Released under the MIT License. */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).artplayerPluginBacklight=e()}(this,(function(){"use strict";function t(t){for(var e=[],o=0;o<10;o+=1)for(var n=0;n<5;n+=1)0!==o&&9!==o&&0!==n&&4!==n||e.push(t(o,n,10,5));return e}return function(e){var o=e.constructor.utils.setStyles,n=e.template,a=n.$player,i=n.$video,r=e.player,c=document.createElement("div");c.classList.add("artplayer-backlight"),o(c,{position:"absolute",zIndex:9,left:0,top:0,right:0,bottom:0,width:"100%",height:"100%"});var l,s=(l=c,t((function(t,e,o,n){var a=document.createElement("div");return a.style.position="absolute",a.style.left="".concat(100*t/o,"%"),a.style.top="".concat(100*e/n,"%"),a.style.width="".concat(100/o,"%"),a.style.height="".concat(100/n,"%"),a.style.webkitBorderRadius="50%",a.style.borderRadius="50%",a.style.webkitTransition="all .2s ease",a.style.transition="all .2s ease",l.appendChild(a),{$box:a,left:0===t,right:t===o-1,top:0===e,bottom:e===n-1}}))),u=document.createElement("canvas");return a.insertBefore(c,i),function o(){setTimeout((function(){if(r.playing){var n=i.clientWidth,a=i.clientHeight;(function(e,o,n,a){var i=e.getContext("2d");return e.width=n,e.height=a,i.drawImage(o,0,0),t((function(t,e,o,r){for(var c=n/o,l=a/r,s=t*c,u=e*l,d=i.getImageData(s,u,c,l).data,f=0,h=0,p=0,g=0,y=d.length;g'.concat(e.get("Danmu opacity"),': 100%
'),mounted:function(e){var r=e.querySelector("input[type=range]"),i=e.querySelector(".art-value");n(r,"change",(function(){var e=r.value;i.innerText=100*Number(e),t.plugins.artplayerPluginDanmuku.config({opacity:Number(e)})})),t.on("artplayerPluginDanmuku:config",(function(t){r.value!==t.opacity&&(r.value=t.opacity,i.innerText=100*t.opacity)}))}}}function o(t){var e=t.i18n,n=t.events.proxy;return{name:"danmuku-size",index:11,html:'
'.concat(e.get("Danmu size"),': 25px
'),mounted:function(e){var r=e.querySelector("input[type=range]"),i=e.querySelector(".art-value");n(r,"change",(function(){var e=r.value;i.innerText=e,t.plugins.artplayerPluginDanmuku.config({fontSize:Number(e)})})),t.on("artplayerPluginDanmuku:config",(function(t){r.value!==t.fontSize&&(r.value=t.fontSize,i.innerText=t.fontSize)}))}}}function u(t){var e=t.i18n,n=t.events.proxy;return{name:"danmuku-speed",index:12,html:'
'.concat(e.get("Danmu speed"),': 5s
'),mounted:function(e){var r=e.querySelector("input[type=range]"),i=e.querySelector(".art-value");n(r,"change",(function(){var e=r.value;i.innerText=e,t.plugins.artplayerPluginDanmuku.config({speed:Number(e)})})),t.on("artplayerPluginDanmuku:config",(function(t){r.value!==t.speed&&(r.value=t.speed,i.innerText=t.speed)}))}}}function s(t){var e=t.i18n,n=t.events.proxy;return{name:"danmuku-synchronousPlayback",index:13,html:'"),mounted:function(e){var r=e.querySelector("input[type=checkbox]");n(r,"change",(function(){t.plugins.artplayerPluginDanmuku.config({synchronousPlayback:r.checked})})),t.on("artplayerPluginDanmuku:config",(function(t){r.checked!==t.synchronousPlayback&&(r.checked=t.synchronousPlayback)}))}}}function l(t,e,n){return t.filter((function(t){return t.$state===e})).map(n)}function c(t,e){var n=t.getBoundingClientRect();return e?n[e]:n}var p=function(t){if(Array.isArray(t))return t};var f=function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var n=[],r=!0,i=!1,a=void 0;try{for(var o,u=t[Symbol.iterator]();!(r=(o=u.next()).done)&&(n.push(o.value),!e||n.length!==e);r=!0);}catch(t){i=!0,a=t}finally{try{r||null==u.return||u.return()}finally{if(i)throw a}}return n}};var h=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n[\S ]*?)<\/d>/gi);return e&&e.length?e.map((function(t){var e=t.match(/(.+)<\/d>/),n=y(e,3),r=n[1],i=n[2],a=r.split(",");return 8===a.length&&i.trim()?{text:i,time:Number(a[0]),mode:g(Number(a[1])),fontSize:Number(a[2]),color:"#".concat(Number(a[3]).toString(16)),timestamp:Number(a[4]),pool:Number(a[5]),userID:a[6],rowID:Number(a[7])}:null})):[]}(t)}))}function b(t,e){var n=y(t.option.margin,2),r=n[0],i=n[1],a=c(t.art.template.$player),o=t.queue.filter((function(t){return t.mode===e.mode&&"emit"===t.$state&&t.$ref&&t.$ref.style.fontSize===e.$ref.style.fontSize&&parseFloat(t.$ref.style.top)<=a.height-i})).map((function(t){var e=c(t.$ref),n=e.width,r=e.height,i=e.top-a.top,o=e.left-a.left;return{top:i,left:o,height:r,width:n,right:a.width-o-n}})).sort((function(t,e){return t.top-e.top}));return 0===o.length?r:(o.unshift({top:0,left:0,right:0,height:r,width:a.width}),o.push({top:a.height-i,left:0,right:0,height:i,width:a.width}),function(t){for(var e=0,n={},r=0;ro&&(e=c,o=p)}if(0===e)for(var f=0,h=0;hf&&(f=m,e=y(g,1)[0].top)}if(0===e){var x=a.filter((function(t,e){return 0!==e&&e!==a.length-1})).sort((function(t,e){return n[t].length-n[e].length}));e=y(x,1)[0]}return e}(o))}function x(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function $(e){for(var n=1;n=t.time&&t.time>=n.currentTime-.1&&"wait"===t.$state})).forEach((function(r){r.$ref=function(t){var e=t.find((function(t){return t.$ref&&"wait"===t.$state}));if(e){var n=e.$ref;return e.$ref=null,n}var r=document.createElement("div");return r.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-family: SimHei, "Microsoft JhengHei", Arial, Helvetica, sans-serif;\n font-weight: normal;\n line-height: 1.125;\n text-shadow: rgb(0, 0, 0) 1px 0px 1px, rgb(0, 0, 0) 0px 1px 1px, rgb(0, 0, 0) 0px -1px 1px, rgb(0, 0, 0) -1px 0px 1px;\n ',r}(t.queue),t.$danmuku.appendChild(r.$ref),r.$ref.style.opacity=t.option.opacity,r.$ref.style.fontSize="".concat(t.option.fontSize,"px"),r.$ref.innerText=r.text,r.$ref.style.color=r.color||"#fff",r.$ref.style.border=r.border?"1px solid ".concat(r.color||"#fff"):"none",r.$restTime=t.option.synchronousPlayback&&n.playbackRate?t.option.speed/Number(n.playbackRate):t.option.speed,r.$lastStartTime=Date.now();var i=c(r.$ref,"width"),a=b(t,r);switch(r.$state="emit",r.mode){case 0:r.$restWidth=e+i+5,r.$ref.style.left="".concat(e,"px"),r.$ref.style.top="".concat(a,"px"),r.$ref.style.transform="translateX(".concat(-r.$restWidth,"px) translateY(0px) translateZ(0px)"),r.$ref.style.transition="transform ".concat(r.$restTime,"s linear 0s");break;case 1:r.$ref.style.top="".concat(a,"px"),r.$ref.style.left="50%",r.$ref.style.marginLeft="-".concat(i/2,"px")}}))}t.isStop||t.update()})),this}},{key:"stop",value:function(){return this.isStop=!0,this.suspend(),window.cancelAnimationFrame(this.animationFrameTimer),this.art.emit("artplayerPluginDanmuku:stop"),this}},{key:"start",value:function(){return this.isStop=!1,this.continue(),this.update(),this.art.emit("artplayerPluginDanmuku:start"),this}},{key:"show",value:function(){return this.isHide=!1,this.$danmuku.style.display="block",this.art.emit("artplayerPluginDanmuku:show"),this}},{key:"hide",value:function(){return this.isHide=!0,this.$danmuku.style.display="none",this.art.emit("artplayerPluginDanmuku:hide"),this}},{key:"emit",value:function(t){var e=this.art,n=e.notice,r=e.player,i=e.i18n,a=this.art.constructor,o=a.utils.clamp;return(0,a.validator)(t,{text:"string",mode:"number|undefined",color:"string|undefined",time:"number|undefined",border:"boolean|undefined"}),t.text.trim()?t.text.length>this.option.maxlength?(n.show="".concat(i.get("The length of the danmu does not exceed")," ").concat(this.option.maxlength),this):(t.time?t.time=o(t.time,0,1/0):t.time=r.currentTime+.5,this.queue.push($($({mode:0},t),{},{$state:"wait",$ref:null,$restTime:0,$lastStartTime:0,$restWidth:0})),this):(n.show=i.get("Danmu text cannot be empty"),this)}}],[{key:"option",get:function(){return{danmuku:[],speed:5,maxlength:50,margin:[10,100],opacity:1,fontSize:25,synchronousPlayback:!1}}},{key:"scheme",get:function(){return{danmuku:"array|function|string",speed:"number",maxlength:"number",margin:"array",opacity:"number",fontSize:"number",synchronousPlayback:"boolean"}}}]),t}();return function(t){return function(e){var n=new k(e,t);return{name:"artplayerPluginDanmuku",emit:n.emit.bind(n),config:n.config.bind(n),hide:n.hide.bind(n),show:n.show.bind(n),get isHide(){return n.isHide}}}}})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).artplayerPluginDanmuku=e()}(this,(function(){"use strict";function t(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function e(t,e){for(var n=0;n'.concat(e.get("Danmu opacity"),': 100%
'),mounted:function(e){var i=e.querySelector("input[type=range]"),r=e.querySelector(".art-value");n(i,"change",(function(){var e=i.value;r.innerText=100*Number(e),t.plugins.artplayerPluginDanmuku.config({opacity:Number(e)})})),t.on("artplayerPluginDanmuku:config",(function(t){i.value!==t.opacity&&(i.value=t.opacity,r.innerText=100*t.opacity)}))}}}function r(t){var e=t.i18n,n=t.events.proxy;return{name:"danmuku-size",index:11,html:'
'.concat(e.get("Danmu size"),': 25px
'),mounted:function(e){var i=e.querySelector("input[type=range]"),r=e.querySelector(".art-value");n(i,"change",(function(){var e=i.value;r.innerText=e,t.plugins.artplayerPluginDanmuku.config({fontSize:Number(e)})})),t.on("artplayerPluginDanmuku:config",(function(t){i.value!==t.fontSize&&(i.value=t.fontSize,r.innerText=t.fontSize)}))}}}function a(t){var e=t.i18n,n=t.events.proxy;return{name:"danmuku-speed",index:12,html:'
'.concat(e.get("Danmu speed"),': 5s
'),mounted:function(e){var i=e.querySelector("input[type=range]"),r=e.querySelector(".art-value");n(i,"change",(function(){var e=i.value;r.innerText=e,t.plugins.artplayerPluginDanmuku.config({speed:Number(e)})})),t.on("artplayerPluginDanmuku:config",(function(t){i.value!==t.speed&&(i.value=t.speed,r.innerText=t.speed)}))}}}function o(t){var e=t.i18n,n=t.events.proxy;return{name:"danmuku-synchronousPlayback",index:13,html:'"),mounted:function(e){var i=e.querySelector("input[type=checkbox]");n(i,"change",(function(){t.plugins.artplayerPluginDanmuku.config({synchronousPlayback:i.checked})})),t.on("artplayerPluginDanmuku:config",(function(t){i.checked!==t.synchronousPlayback&&(i.checked=t.synchronousPlayback)}))}}}function u(t,e,n){return t.filter((function(t){return t.$state===e})).map(n)}function s(t,e){var n=t.getBoundingClientRect();return e?n[e]:n}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n[\S ]*?)<\/d>/gi);return e&&e.length?e.map((function(t){var e=c(t.match(/(.+)<\/d>/),3),n=e[1],i=e[2],r=n.split(",");return 8===r.length&&i.trim()?{text:i,time:Number(r[0]),mode:p(Number(r[1])),fontSize:Number(r[2]),color:"#".concat(Number(r[3]).toString(16)),timestamp:Number(r[4]),pool:Number(r[5]),userID:r[6],rowID:Number(r[7])}:null})):[]}(t)}))}function h(t,e){var n=c(t.option.margin,2),i=n[0],r=n[1],a=s(t.art.template.$player),o=t.queue.filter((function(t){return t.mode===e.mode&&"emit"===t.$state&&t.$ref&&t.$ref.style.fontSize===e.$ref.style.fontSize&&parseFloat(t.$ref.style.top)<=a.height-r})).map((function(t){var e=s(t.$ref),n=e.width,i=e.height,r=e.top-a.top,o=e.left-a.left;return{top:r,left:o,height:i,width:n,right:a.width-o-n}})).sort((function(t,e){return t.top-e.top}));return 0===o.length?i:(o.unshift({top:0,left:0,right:0,height:i,width:a.width}),o.push({top:a.height-r,left:0,right:0,height:r,width:a.width}),function(t){for(var e=0,n={},i=0;io&&(e=p,o=f)}if(0===e)for(var h=0,m=0;mh&&(h=d,e=c(g,1)[0].top)}if(0===e){var x=a.filter((function(t,e){return 0!==e&&e!==a.length-1})).sort((function(t,e){return n[t].length-n[e].length}));e=c(x,1)[0]}return e}(o))}function m(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function d(e){for(var n=1;n=t.time&&t.time>=n.currentTime-.1&&"wait"===t.$state})).forEach((function(i){i.$ref=function(t){var e=t.find((function(t){return t.$ref&&"wait"===t.$state}));if(e){var n=e.$ref;return e.$ref=null,n}var i=document.createElement("div");return i.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-family: SimHei, "Microsoft JhengHei", Arial, Helvetica, sans-serif;\n font-weight: normal;\n line-height: 1.125;\n text-shadow: rgb(0, 0, 0) 1px 0px 1px, rgb(0, 0, 0) 0px 1px 1px, rgb(0, 0, 0) 0px -1px 1px, rgb(0, 0, 0) -1px 0px 1px;\n ',i}(t.queue),t.$danmuku.appendChild(i.$ref),i.$ref.style.opacity=t.option.opacity,i.$ref.style.fontSize="".concat(t.option.fontSize,"px"),i.$ref.innerText=i.text,i.$ref.style.color=i.color||"#fff",i.$ref.style.border=i.border?"1px solid ".concat(i.color||"#fff"):"none",i.$restTime=t.option.synchronousPlayback&&n.playbackRate?t.option.speed/Number(n.playbackRate):t.option.speed,i.$lastStartTime=Date.now();var r=s(i.$ref,"width"),a=h(t,i);switch(i.$state="emit",i.mode){case 0:i.$restWidth=e+r+5,i.$ref.style.left="".concat(e,"px"),i.$ref.style.top="".concat(a,"px"),i.$ref.style.transform="translateX(".concat(-i.$restWidth,"px) translateY(0px) translateZ(0px)"),i.$ref.style.transition="transform ".concat(i.$restTime,"s linear 0s");break;case 1:i.$ref.style.top="".concat(a,"px"),i.$ref.style.left="50%",i.$ref.style.marginLeft="-".concat(r/2,"px")}}))}t.isStop||t.update()})),this}},{key:"stop",value:function(){return this.isStop=!0,this.suspend(),window.cancelAnimationFrame(this.animationFrameTimer),this.art.emit("artplayerPluginDanmuku:stop"),this}},{key:"start",value:function(){return this.isStop=!1,this.continue(),this.update(),this.art.emit("artplayerPluginDanmuku:start"),this}},{key:"show",value:function(){return this.isHide=!1,this.$danmuku.style.display="block",this.art.emit("artplayerPluginDanmuku:show"),this}},{key:"hide",value:function(){return this.isHide=!0,this.$danmuku.style.display="none",this.art.emit("artplayerPluginDanmuku:hide"),this}},{key:"emit",value:function(t){var e=this.art,n=e.notice,i=e.player,r=e.i18n,a=this.art.constructor,o=a.utils.clamp;return(0,a.validator)(t,{text:"string",mode:"number|undefined",color:"string|undefined",time:"number|undefined",border:"boolean|undefined"}),t.text.trim()?t.text.length>this.option.maxlength?(n.show="".concat(r.get("The length of the danmu does not exceed")," ").concat(this.option.maxlength),this):(t.time?t.time=o(t.time,0,1/0):t.time=i.currentTime+.5,this.queue.push(d(d({mode:0},t),{},{$state:"wait",$ref:null,$restTime:0,$lastStartTime:0,$restWidth:0})),this):(n.show=r.get("Danmu text cannot be empty"),this)}}],p=[{key:"option",get:function(){return{danmuku:[],speed:5,maxlength:50,margin:[10,100],opacity:1,fontSize:25,synchronousPlayback:!1}}},{key:"scheme",get:function(){return{danmuku:"array|function|string",speed:"number",maxlength:"number",margin:"array",opacity:"number",fontSize:"number",synchronousPlayback:"boolean"}}}],c&&e(l.prototype,c),p&&e(l,p),t}();return function(t){return function(e){var n=new y(e,t);return{name:"artplayerPluginDanmuku",emit:n.emit.bind(n),config:n.config.bind(n),hide:n.hide.bind(n),show:n.show.bind(n),get isHide(){return n.isHide}}}}})); diff --git a/packages/artplayer-tool-github/dist/artplayer-tool-github.js b/packages/artplayer-tool-github/dist/artplayer-tool-github.js index 39eb30e40..ea6ea12e3 100644 --- a/packages/artplayer-tool-github/dist/artplayer-tool-github.js +++ b/packages/artplayer-tool-github/dist/artplayer-tool-github.js @@ -1,8 +1,8 @@ /*! - * artplayer-tool-github.js v3.5.31 + * artplayer-tool-github.js v4.0.0 * Github: https://github.com/zhw2590582/ArtPlayer#readme * (c) 2017-2021 Harvey Zack * Released under the MIT License. */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).ArtplayerToolGithub=e()}(this,(function(){"use strict";"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;return function(t,e){return t(e={exports:{}},e.exports),e.exports}((function(t,e){t.exports=function(){var t,e=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t},r=function(t){for(var r=1;r0&&void 0!==arguments[0]?arguments[0]:{};return t(this,r),(e=o.call(this)).processing=!1,e.option={},e.setup(Object.assign({},r.DEFAULTS,n)),e.video=r.creatVideo(),e.duration=0,e.inputChange=e.inputChange.bind(i(e)),e.ondrop=e.ondrop.bind(i(e)),e.option.fileInput.addEventListener("change",e.inputChange),e.option.fileInput.addEventListener("dragover",r.ondragover),e.option.fileInput.addEventListener("drop",r.ondrop),e}return n(r,[{key:"ondrop",value:function(t){t.preventDefault();var e=t.dataTransfer.files[0];this.loadVideo(e)}},{key:"setup",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.option=Object.assign({},this.option,e);var n=this.option,i=n.fileInput,o=n.delay,r=n.number,a=n.width,s=n.height,u=n.column;if(this.errorHandle(i instanceof Element,"The 'fileInput' is not a Element"),"INPUT"!==i.tagName||"file"!==i.type){i.style.position="relative";var h=document.createElement("input");h.type="file",h.style.position="absolute",h.style.width="100%",h.style.height="100%",h.style.left="0",h.style.top="0",h.style.right="0",h.style.bottom="0",h.style.opacity="0",i.appendChild(h),this.option.fileInput=h}return["delay","number","width","height","column","begin","end"].forEach((function(e){t.errorHandle("number"==typeof t.option[e],"The '".concat(e,"' is not a number"))})),this.option.delay=d(o,10,1e3),this.option.number=d(r,10,1e3),this.option.width=d(a,10,1e3),this.option.height=d(s,10,1e3),this.option.column=d(u,1,1e3),this}},{key:"inputChange",value:function(){var t=this.option.fileInput.files[0];this.loadVideo(t)}},{key:"loadVideo",value:function(t){var e=this,n=this.option.delay;if(t){var i=this.video.canPlayType(t.type);this.errorHandle("maybe"===i||"probably"===i,"Playback of this file format is not supported: ".concat(t.type));var o=URL.createObjectURL(t);this.videoUrl=o,this.file=t,this.emit("file",this.file),this.video.src=o,p(n).then((function(){e.emit("video",e.video)})).catch((function(t){throw e.emit("error",t.message),t}))}}},{key:"start",value:function(){var t=this;if(!this.video.duration)return p(1e3).then(this.start);var e=this.option,n=e.width,i=e.height,o=e.number,r=e.delay,a=e.begin,s=e.end;this.option.begin=d(a,0,this.video.duration),this.option.end=d(s||this.video.duration,a,this.video.duration),this.errorHandle(this.option.end>this.option.begin,"End time must be greater than the start time"),this.duration=this.option.end-this.option.begin,this.density=o/this.duration,this.errorHandle(this.file&&this.video,"Please select the video file first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment..."),this.errorHandle(this.density<=1,"The preview density cannot be greater than 1, but got ".concat(this.density));var u=this.creatScreenshotDate(),h=this.creatCanvas(),c=h.getContext("2d");this.emit("canvas",h);var l,f=u.map((function(e,a){return function(){return t.video.currentTime=e.time,new Promise((function(s){p(r).then((function(){c.drawImage(t.video,e.x,e.y,n,i),h.toBlob((function(e){t.thumbnailUrl&&URL.revokeObjectURL(t.thumbnailUrl),t.thumbnailUrl=URL.createObjectURL(e),t.emit("update",t.thumbnailUrl,(a+1)/o),s()}))})).catch((function(t){throw t}))}))}}));return this.processing=!0,(l=f,l.reduce((function(t,e){return t.then(e)}),Promise.resolve())).then((function(){return p(2*r).then((function(){t.processing=!1,t.emit("done")})).catch((function(e){throw t.processing=!1,t.emit("error",e.message),e}))})).catch((function(e){throw t.processing=!1,t.emit("error",e.message),e}))}},{key:"creatScreenshotDate",value:function(){for(var t=this.option,e=t.number,n=t.width,i=t.height,o=t.column,r=t.begin,a=this.duration/e,s=[r+a];s.length0&&void 0!==arguments[0]?arguments[0]:{};return t(this,f),(e=u.call(this)).processing=!1,e.option={},e.setup(Object.assign({},f.DEFAULTS,i)),e.video=f.creatVideo(),e.duration=0,e.inputChange=e.inputChange.bind(n(e)),e.ondrop=e.ondrop.bind(n(e)),e.option.fileInput.addEventListener("change",e.inputChange),e.option.fileInput.addEventListener("dragover",f.ondragover),e.option.fileInput.addEventListener("drop",f.ondrop),e}return r=f,a=[{key:"ondrop",value:function(t){t.preventDefault();var e=t.dataTransfer.files[0];this.loadVideo(e)}},{key:"setup",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.option=Object.assign({},this.option,e);var n=this.option,i=n.fileInput,o=n.delay,r=n.number,a=n.width,s=n.height,u=n.column;if(this.errorHandle(i instanceof Element,"The 'fileInput' is not a Element"),"INPUT"!==i.tagName||"file"!==i.type){i.style.position="relative";var h=document.createElement("input");h.type="file",h.style.position="absolute",h.style.width="100%",h.style.height="100%",h.style.left="0",h.style.top="0",h.style.right="0",h.style.bottom="0",h.style.opacity="0",i.appendChild(h),this.option.fileInput=h}return["delay","number","width","height","column","begin","end"].forEach((function(e){t.errorHandle("number"==typeof t.option[e],"The '".concat(e,"' is not a number"))})),this.option.delay=l(o,10,1e3),this.option.number=l(r,10,1e3),this.option.width=l(a,10,1e3),this.option.height=l(s,10,1e3),this.option.column=l(u,1,1e3),this}},{key:"inputChange",value:function(){var t=this.option.fileInput.files[0];this.loadVideo(t)}},{key:"loadVideo",value:function(t){var e=this,n=this.option.delay;if(t){var i=this.video.canPlayType(t.type);this.errorHandle("maybe"===i||"probably"===i,"Playback of this file format is not supported: ".concat(t.type));var o=URL.createObjectURL(t);this.videoUrl=o,this.file=t,this.emit("file",this.file),this.video.src=o,h(n).then((function(){e.emit("video",e.video)})).catch((function(t){throw e.emit("error",t.message),t}))}}},{key:"start",value:function(){var t=this;if(!this.video.duration)return h(1e3).then(this.start);var e=this.option,n=e.width,i=e.height,o=e.number,r=e.delay,a=e.begin,s=e.end;this.option.begin=l(a,0,this.video.duration),this.option.end=l(s||this.video.duration,a,this.video.duration),this.errorHandle(this.option.end>this.option.begin,"End time must be greater than the start time"),this.duration=this.option.end-this.option.begin,this.density=o/this.duration,this.errorHandle(this.file&&this.video,"Please select the video file first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment..."),this.errorHandle(this.density<=1,"The preview density cannot be greater than 1, but got ".concat(this.density));var u=this.creatScreenshotDate(),c=this.creatCanvas(),f=c.getContext("2d");this.emit("canvas",c);var p,d=u.map((function(e,a){return function(){return t.video.currentTime=e.time,new Promise((function(s){h(r).then((function(){f.drawImage(t.video,e.x,e.y,n,i),c.toBlob((function(e){t.thumbnailUrl&&URL.revokeObjectURL(t.thumbnailUrl),t.thumbnailUrl=URL.createObjectURL(e),t.emit("update",t.thumbnailUrl,(a+1)/o),s()}))})).catch((function(t){throw t}))}))}}));return this.processing=!0,(p=d,p.reduce((function(t,e){return t.then(e)}),Promise.resolve())).then((function(){return h(2*r).then((function(){t.processing=!1,t.emit("done")})).catch((function(e){throw t.processing=!1,t.emit("error",e.message),e}))})).catch((function(e){throw t.processing=!1,t.emit("error",e.message),e}))}},{key:"creatScreenshotDate",value:function(){for(var t=this.option,e=t.number,n=t.width,i=t.height,o=t.column,r=t.begin,a=this.duration/e,s=[r+a];s.length1?r-1:0),o=1;o1&&void 0!==arguments[1]?arguments[1]:document;return e.querySelector(t)}function g(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(e.querySelectorAll(t))}function m(t,e){return t.classList.add(e)}function b(t,e){return t.classList.remove(e)}function w(t,e){return t.classList.contains(e)}function x(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function O(t){return t.parentNode.removeChild(t)}function k(t,e,r){return t.style[e]=r,t}function j(t,e){return Object.keys(e).forEach((function(r){k(t,r,e[r])})),t}function P(t,e){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=window.getComputedStyle(t,null).getPropertyValue(e);return r?parseFloat(n):n}function S(t){return Array.from(t.parentElement.children).filter((function(e){return e!==t}))}function E(t,e){S(t).forEach((function(t){return b(t,e)})),m(t,e)}function R(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"up";d||(t.setAttribute("aria-label",e),t.setAttribute("data-balloon-pos",r))}function $(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=t.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight,o=window.innerWidth||document.documentElement.clientWidth,i=r.top-e<=n&&r.top+r.height+e>=0,a=r.left-e<=o+e&&r.left+r.width+e>=0;return i&&a}function T(t,e){return t.composedPath&&t.composedPath().indexOf(e)>-1}function D(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function z(t,e,r){return z=D()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var i=new(Function.bind.apply(t,n));return r&&o(i,r.prototype),i},z.apply(null,arguments)}function A(t){var e="function"==typeof Map?new Map:void 0;return A=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return z(t,arguments,l(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),o(n,t)},A(t)}function C(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l(t);if(e){var o=l(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var L=function(e){i(o,e);var r=C(o);function o(e,i){var a;return t(this,o),a=r.call(this,e),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(n(a),i||a.constructor),a.name="ArtPlayerError",a}return o}(A(Error));function M(t,e){if(!t)throw new L(e);return t}function F(t){return"WEBVTT \r\n\r\n".concat(t.replace(/{[\s\S]*?}/g,"").replace(/\{\\([ibu])\}/g,"").replace(/\{\\([ibu])1\}/g,"<$1>").replace(/\{([ibu])\}/g,"<$1>").replace(/\{\/([ibu])\}/g,"").replace(/(\d\d:\d\d:\d\d),(\d\d\d)/g,"$1.$2").concat("\r\n\r\n"))}function q(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function B(t){var e=new RegExp("Dialogue:\\s\\d,(\\d+:\\d\\d:\\d\\d.\\d\\d),(\\d+:\\d\\d:\\d\\d.\\d\\d),([^,]*),([^,]*),(?:[^,]*,){4}([\\s\\S]*)$","i");function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return t.split(/[:.]/).map((function(t,e,r){if(e===r.length-1){if(1===t.length)return".".concat(t,"00");if(2===t.length)return".".concat(t,"0")}else if(1===t.length)return(0===e?"0":":0")+t;return 0===e?t:e===r.length-1?".".concat(t):":".concat(t)})).join("")}return"WEBVTT\n\n".concat(t.split(/\r?\n/).map((function(t){var n=t.match(e);return n?{start:r(n[1].trim()),end:r(n[2].trim()),text:n[5].replace(/{[\s\S]*?}/g,"").replace(/(\\N)/g,"\n").trim().split(/\r?\n/).map((function(t){return t.trim()})).join("\n")}:null})).filter((function(t){return t})).map((function(t,e){return t?"".concat(e+1,"\n").concat(t.start," --\x3e ").concat(t.end,"\n").concat(t.text):""})).filter((function(t){return t.trim()})).join("\n\n"))}function I(t){return t.includes("?")?I(t.split("?")[0]):t.includes("#")?I(t.split("#")[0]):t.trim().toLowerCase().split(".").pop()}function W(t,e){var r=document.createElement("a");r.style.display="none",r.href=t,r.download=e,document.body.appendChild(r),r.click(),document.body.removeChild(r)}function V(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r1?e-1:0),n=1;n0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(e){return setTimeout(e,t)}))}function Z(t,e){var r,n,o=!1;return function i(){for(var a=arguments.length,c=new Array(a),l=0;l0?[e,r,n]:[r,n]).map((function(t){return t<10?"0".concat(t):String(t)})).join(":")}function K(t){return t.replace(/[&<>'"]/g,(function(t){return{"&":"&","<":"<",">":">","'":"'",'"':"""}[t]||t}))}var tt=Object.freeze({__proto__:null,query:v,queryAll:g,addClass:m,removeClass:b,hasClass:w,append:x,remove:O,setStyle:k,setStyles:j,getStyle:P,sublings:S,inverseClass:E,tooltip:R,isInViewport:$,includeFromEvent:T,ArtPlayerError:L,errorHandle:M,srtToVtt:F,vttToBlob:q,assToVtt:B,getExt:I,download:W,def:N,has:_,proxyPropertys:X,mergeDeep:Q,sleep:Y,debounce:function(t,e,r){var n;function o(){for(var o=arguments.length,i=new Array(o),a=0;a-1;case"function":return t(r.userAgent);case"regexp":return t.test(r.userAgent);default:return!1}}))},ht=function(){function e(r){var n=this;t(this,e),this.art=r,r.option.container instanceof Element?this.$container=r.option.container:(this.$container=v(r.option.container),M(this.$container,"No container element found by ".concat(r.option.container))),M(r.constructor.instances.every((function(t){return t.template.$container!==n.$container})),"Cannot mount multiple instances on the same dom element"),r.whitelist.state?this.desktop():this.mobile()}return r(e,[{key:"query",value:function(t){return v(t,this.$container)}},{key:"desktop",value:function(){var t=this.art.option,r=t.backdrop,n=t.theme;t.useSSR||(this.$container.innerHTML=e.html),this.$undercover=this.query(".art-undercover"),this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video"),this.$poster=this.query(".art-poster"),this.$subtitle=this.query(".art-subtitle"),this.$danmuku=this.query(".art-danmuku"),this.$bottom=this.query(".art-bottom"),this.$progress=this.query(".art-progress"),this.$controls=this.query(".art-controls"),this.$controlsLeft=this.query(".art-controls-left"),this.$controlsRight=this.query(".art-controls-right"),this.$layer=this.query(".art-layers"),this.$loading=this.query(".art-loading"),this.$notice=this.query(".art-notice"),this.$noticeInner=this.query(".art-notice-inner"),this.$mask=this.query(".art-mask"),this.$state=this.query(".art-state"),this.$setting=this.query(".art-settings"),this.$settingInner=this.query(".art-setting-inner"),this.$settingBody=this.query(".art-setting-body"),this.$info=this.query(".art-info"),this.$infoPanel=this.query(".art-info-panel"),this.$infoClose=this.query(".art-info-close"),this.$miniHeader=this.query(".art-mini-header"),this.$miniTitle=this.query(".art-mini-title"),this.$miniClose=this.query(".art-mini-close"),this.$contextmenu=this.query(".art-contextmenus"),this.$player.style.setProperty("--theme",n),r&&(m(this.$settingInner,"art-backdrop-filter"),m(this.$contextmenu,"art-backdrop-filter"),this.$info&&m(this.$info,"art-backdrop-filter")),this.art.isMobile&&m(this.$container,"art-mobile")}},{key:"mobile",value:function(){this.$container.innerHTML='
',this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video")}},{key:"destroy",value:function(t){t?this.$container.innerHTML="":m(this.$player,"art-destroy")}}],[{key:"html",get:function(){return'
Player version:
3.5.31
Video url:
Video volume:
Video time:
Video duration:
Video resolution:
x
[x]
xD7
'}}]),e}(),yt={"Video info":"统计信息",Close:"关闭","Light Off":"关灯","Light On":"开灯","Video load failed":"加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音",Flip:"翻转",Rotate:"旋转",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新连接","Hide subtitle":"隐藏字幕","Show subtitle":"显示字幕","Hide danmu":"隐藏弹幕","Show danmu":"显示弹幕","Show setting":"显示设置","Hide setting":"隐藏设置",Screenshot:"截图","Play speed":"播放速度","Aspect ratio":"画面比例",Default:"默认",Normal:"正常",Open:"打开","Switch video":"切换","Switch subtitle":"切换字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"网页全屏","Exit web fullscreen":"退出网页全屏","Mini player":"迷你播放器","PIP mode":"画中画模式","Exit PIP mode":"退出画中画模式","PIP not supported":"不支持画中画模式","Fullscreen not supported":"不支持全屏模式","Local Subtitle":"本地字幕","Local Video":"本地视频","Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},vt={"Video info":"統計訊息",Close:"關閉","Light Off":"關燈","Light On":"開燈","Video load failed":"載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"翻轉",Rotate:"旋轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide subtitle":"隱藏字幕","Show subtitle":"顯示字幕","Hide danmu":"隱藏彈幕","Show danmu":"顯示彈幕","Show setting":"顯示设置","Hide setting":"隱藏设置",Screenshot:"截圖","Play speed":"播放速度","Aspect ratio":"畫面比例",Default:"默認",Normal:"正常",Open:"打開","Switch video":"切換","Switch subtitle":"切換字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"網頁全屏","Exit web fullscreen":"退出網頁全屏","Mini player":"迷你播放器","PIP mode":"畫中畫模式","Exit PIP mode":"退出畫中畫模式","PIP not supported":"不支持畫中畫模式","Fullscreen not supported":"不支持全屏模式","Local Subtitle":"本地字幕","Local Video":"本地視頻","Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"},gt=function(){function e(r){t(this,e),this.art=r,this.languages={"zh-cn":yt,"zh-tw":vt},this.init()}return r(e,[{key:"init",value:function(){var t=this.art.option.lang.toLowerCase();this.language=this.languages[t]||{}}},{key:"get",value:function(t){return this.language[t]||t}},{key:"update",value:function(t){this.languages=Q(this.languages,t),this.init()}}]),e}();var mt={exports:{}};!function(t){!function(){var e="undefined"!=typeof window&&void 0!==window.document?window.document:{},r=t.exports,n=function(){for(var t,r=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],n=0,o=r.length,i={};nd){var h=d*s/l;k(n,"width","".concat(100*h,"%")),k(n,"height","100%"),k(n,"padding","0 ".concat((u-u*h)/2,"px"))}else{var y=l/d/s;k(n,"width","100%"),k(n,"height","".concat(100*y,"%")),k(n,"padding","".concat((p-p*y)/2,"px 0"))}o.dataset.aspectRatio=e}a.show="".concat(i.get("Aspect ratio"),": ").concat("default"===e?i.get("Default"):e),t.emit("aspectRatio",e)}}),N(e,"aspectRatioReset",{set:function(t){if(t&&e.aspectRatio){var r=e.aspectRatio;e.aspectRatio=r}}})}(r,this),function(t,e){var r=t.option,n=t.notice,o=t.template.$video,i=document.createElement("canvas");N(e,"getDataURL",{value:function(){return new Promise((function(t,e){try{i.width=o.videoWidth,i.height=o.videoHeight,i.getContext("2d").drawImage(o,0,0),t(i.toDataURL("image/png"))}catch(t){n.show=t,e(t)}}))}}),N(e,"getBlobUrl",{value:function(){return new Promise((function(t,e){try{i.width=o.videoWidth,i.height=o.videoHeight,i.getContext("2d").drawImage(o,0,0),i.toBlob((function(e){t(URL.createObjectURL(e))}))}catch(t){n.show=t,e(t)}}))}}),N(e,"screenshot",{value:function(){e.getDataURL().then((function(e){W(e,"".concat(r.title||"artplayer","_").concat(G(o.currentTime),".png")),t.emit("screenshot",e)}))}})}(r,this),wt(r,this),function(t,e){var r=t.template.$player;N(e,"fullscreenWeb",{get:function(){return w(r,"art-fullscreen-web")},set:function(n){n?(m(r,"art-fullscreen-web"),e.aspectRatioReset=!0,t.emit("resize"),t.emit("fullscreenWeb",!0)):(b(r,"art-fullscreen-web"),e.aspectRatioReset=!0,e.autoSize=t.option.autoSize,t.emit("resize"),t.emit("fullscreenWeb"))}}),N(e,"fullscreenWebToggle",{set:function(t){t&&(e.fullscreenWeb=!e.fullscreenWeb)}})}(r,this),function(t,e){var r=t.template,n=r.$container,o=r.$player;N(e,"fullscreenRotate",{get:function(){return w(n,"art-fullscreen-rotate")},set:function(r){if(r){m(n,"art-fullscreen-rotate"),e.autoSize=!0;var i=document.body,a=i.clientHeight,c=i.clientWidth,l=o.clientHeight,s=o.clientWidth;if(c/a0&&!r.paused&&!r.ended&&r.readyState>2)}})}(r,this),function(t,e){var r=t.template,n=r.$container,o=r.$player,i=r.$video;N(e,"autoSize",{get:function(){return w(n,"art-auto-size")},set:function(r){if(r){var a=i.videoWidth,c=i.videoHeight,l=n.getBoundingClientRect(),s=l.width,u=l.height,p=a/c,f=s/u;if(m(n,"art-auto-size"),f>p)k(o,"width","".concat(u*p/s*100,"%")),k(o,"height","100%");else{var d=s/p/u*100;k(o,"width","100%"),k(o,"height","".concat(d,"%"))}t.emit("autoSize",{width:e.width,height:e.height})}else b(n,"art-auto-size"),k(o,"width",null),k(o,"height",null),t.emit("autoSize")}})}(r,this),function(t,e){N(e,"rect",{get:function(){return t.template.$player.getBoundingClientRect()}}),["bottom","height","left","right","top","width"].forEach((function(t){N(e,t,{get:function(){return e.rect[t]}})})),N(e,"x",{get:function(){return e.left+window.pageXOffset}}),N(e,"y",{get:function(){return e.top+window.pageYOffset}})}(r,this),function(t,e){var r=t.template.$player,n=t.i18n,o=t.notice;N(e,"flip",{get:function(){return r.dataset.flip},set:function(i){i||(i="normal");var a=["normal","horizontal","vertical"];M(a.includes(i),"'flip' only accept ".concat(a.toString()," as parameters")),"normal"===i?delete r.dataset.flip:(e.rotate=!1,r.dataset.flip=i);var c=i.replace(i[0],i[0].toUpperCase());o.show="".concat(n.get("Flip"),": ").concat(n.get(c)),t.emit("flip",i)}}),N(e,"flipReset",{set:function(t){if(t&&e.flip){var r=e.flip;e.flip=r}}})}(r,this),function(t,e){var r=t.template.$undercover;N(e,"light",{get:function(){return"none"!==P(r,"display",!1)},set:function(e){k(r,"display",e?"block":"none"),t.emit("light",e)}})}(r,this),function(t,e){var r=t.i18n,n=t.option,o=t.storage,i=t.events.proxy,a=t.template,c=a.$player,l=a.$miniClose,s=a.$miniTitle,u=a.$miniHeader,p="",f=!1,d=0,h=0,y=0,v=0;i(u,"mousedown",(function(t){f=!0,d=t.pageX,h=t.pageY,y=e.left,v=e.top})),i(document,"mousemove",(function(t){if(f){m(c,"art-is-dragging");var e=v+t.pageY-h,r=y+t.pageX-d;k(c,"top","".concat(e,"px")),k(c,"left","".concat(r,"px")),o.set("top",e),o.set("left",r)}})),i(document,"mouseup",(function(){f=!1,b(c,"art-is-dragging")})),i(l,"click",(function(){e.mini=!1,f=!1,b(c,"art-is-dragging")})),x(s,n.title||r.get("Mini player")),N(e,"mini",{get:function(){return w(c,"art-mini")},set:function(r){if(r){e.autoSize=!1,p=c.style.cssText,m(c,"art-mini");var i=o.get("top"),a=o.get("left");if(i&&a)k(c,"top","".concat(i,"px")),k(c,"left","".concat(a,"px")),$(u)||(o.del("top"),o.del("left"),e.mini=!0);else{var l=document.body,s=l.clientHeight-e.height-50,f=l.clientWidth-e.width-50;o.set("top",s),o.set("left",f),k(c,"top","".concat(s,"px")),k(c,"left","".concat(f,"px"))}e.aspectRatio=!1,e.playbackRate=!1,t.emit("mini",!0)}else c.style.cssText=p,b(c,"art-mini"),k(c,"top",null),k(c,"left",null),e.aspectRatio=!1,e.playbackRate=!1,e.autoSize=n.autoSize,t.emit("mini")}}),N(e,"miniToggle",{set:function(t){t&&(e.mini=!e.mini)}})}(r,this),function(t,e){var r=[];N(e,"loop",{get:function(){return r},set:function(n){if(Array.isArray(n)&&"number"==typeof n[0]&&"number"==typeof n[1]){var o=J(n[0],0,Math.min(n[1],e.duration)),i=J(n[1],o,e.duration);i-o>=1?(r=[o,i],t.emit("loop",r)):(r=[],t.emit("loop"))}else r=[],t.emit("loop")}}),t.on("video:timeupdate",(function(){r.length&&(e.currentTimer[1])&&(e.seek=r[0])}))}(r,this),function(t,e){var r=t.template,n=r.$video,o=r.$player,i=t.i18n,a=t.notice;N(e,"rotate",{get:function(){return Number(o.dataset.rotate)||0},set:function(r){r||(r=0);var c=[-270,-180,-90,0,90,180,270];if(M(c.includes(r),"'rotate' only accept ".concat(c.toString()," as parameters")),0===r)delete o.dataset.rotate,k(n,"transform",null);else{e.flip=!1,o.dataset.rotate=r;var l=function(){var t=n.videoWidth,e=n.videoHeight;return t>e?e/t:t/e},s=0,u=1;switch(r){case-270:s=90,u=l();break;case-180:s=180;break;case-90:s=270,u=l();break;case 90:s=90,u=l();break;case 180:s=180;break;case 270:s=270,u=l()}k(n,"transform","rotate(".concat(s,"deg) scale(").concat(u,")"))}a.show="".concat(i.get("Rotate"),": ").concat(r,"°"),t.emit("rotate",r)}}),N(e,"rotateReset",{set:function(t){if(t&&e.rotate){var r=e.rotate;e.rotate=r}}})}(r,this),function(t,e){var r=t.option,n=t.template.$poster;N(e,"poster",{get:function(){return r.poster},set:function(t){r.poster=t,k(n,"backgroundImage","url(".concat(t,")"))}})}(r,this),X(r,this)};function kt(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=l(t)););return t}function jt(){return jt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=kt(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(arguments.length<3?t:r):o.value}},jt.apply(this,arguments)}var Pt=function(){function e(r){t(this,e),this.id=0,this.art=r,this.add=this.add.bind(this)}return r(e,[{key:"show",get:function(){return w(this.art.template.$player,"art-".concat(this.name,"-show"))},set:function(t){var e=this.art.template.$player,r="art-".concat(this.name,"-show");t?m(e,r):b(e,r),this.art.emit(this.name,t)}},{key:"toggle",set:function(t){t&&(this.show=!this.show)}},{key:"add",value:function(t){var e=this,r="function"==typeof t?t(this.art):t;if(this.$parent&&this.name&&!r.disable){var n=r.name||"".concat(this.name).concat(this.id);M(!_(this,n),"Cannot add an existing name [".concat(n,"] to the [").concat(this.name,"]")),this.id+=1;var o=document.createElement("div");m(o,"art-".concat(this.name)),m(o,"art-".concat(this.name,"-").concat(n));var i=Array.from(this.$parent.children);o.dataset.index=r.index||this.id;var a=i.find((function(t){return Number(t.dataset.index)>=Number(o.dataset.index)}));a?a.insertAdjacentElement("beforebegin",o):x(this.$parent,o),r.html&&x(o,r.html),r.style&&j(o,r.style),r.tooltip&&R(o,r.tooltip),r.click&&this.art.events.proxy(o,"click",(function(t){t.preventDefault(),r.click.call(e.art,e,t)})),r.selector&&["left","right"].includes(r.position)&&this.selector(r,o),r.mounted&&r.mounted.call(this.art,o),1===o.childNodes.length&&3===o.childNodes[0].nodeType&&m(o,"art-control-onlyText")}}},{key:"selector",value:function(t,e){var r=this,n=this.art.events,o=n.hover,i=n.proxy;m(e,"art-control-selector");var a=document.createElement("div");m(a,"art-selector-value"),x(a,t.html),e.innerText="",x(e,a);var c=t.selector.map((function(t){return'
'.concat(t.name,"
")})).join(""),l=document.createElement("div");m(l,"art-selector-list"),x(l,c),x(e,l);var s=function(){l.style.left="-".concat(P(l,"width")/2-P(e,"width")/2,"px")};o(e,s),i(e,"click",(function(e){if(w(e.target,"art-selector-item")){var n=e.target.innerText;if(a.innerText===n)return;var o=t.selector.find((function(t){return t.name===n}));a.innerText=n,s(),o&&(t.onSelect&&t.onSelect.call(r.art,o),r.art.emit("selector",o))}}))}}]),e}();function St(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Et(t){for(var e=1;e
'),mounted:function(t){var r=!1,o=v(".art-progress-loaded",t),c=v(".art-progress-played",t),l=v(".art-progress-highlight",t),s=v(".art-progress-indicator",t),u=v(".art-progress-tip",t);function p(t,e){"loaded"===t&&k(o,"width","".concat(100*e,"%")),"played"===t&&(k(c,"width","".concat(100*e,"%")),k(s,"left","calc(".concat(100*e,"% - ").concat(P(s,"width")/2,"px)")))}n.forEach((function(t){var e=J(t.time,0,a.duration)/a.duration*100;x(l,''))})),p("loaded",a.loaded),e.on("video:progress",(function(){p("loaded",a.loaded)})),e.on("video:timeupdate",(function(){p("played",a.played)})),e.on("video:ended",(function(){p("played",1)})),i(t,"mousemove",(function(r){k(u,"display","block"),T(r,l)?function(r){var n=Mt(e,r).width,o=r.target.dataset.text;u.innerHTML=o;var i=u.clientWidth;n<=i/2?k(u,"left",0):n>t.clientWidth-i/2?k(u,"left","".concat(t.clientWidth-i,"px")):k(u,"left","".concat(n-i/2,"px"))}(r):function(r){var n=Mt(e,r),o=n.width,i=n.time;u.innerHTML=i;var a=u.clientWidth;o<=a/2?k(u,"left",0):o>t.clientWidth-a/2?k(u,"left","".concat(t.clientWidth-a,"px")):k(u,"left","".concat(o-a/2,"px"))}(r)})),i(t,"mouseout",(function(){k(u,"display","none")})),i(t,"click",(function(t){if(t.target!==s){var r=Mt(e,t),n=r.second;p("played",r.percentage),a.seek=n}})),i(s,"mousedown",(function(){r=!0})),i(document,"mousemove",(function(t){if(r){var n=Mt(e,t),o=n.second,i=n.percentage;m(s,"art-show-indicator"),p("played",i),a.seek=o}})),i(document,"mouseup",(function(){r&&(r=!1,b(s,"art-show-indicator"))}))}})}}function qt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Bt(t){for(var e=1;en.clientWidth-l/2?k(t,"left","".concat(n.clientWidth-l,"px")):k(t,"left","".concat(i-l/2,"px"))}(o))})),i(n,"mouseout",(function(){k(t,"display","none")}))}})}}function Yt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Zt(t){for(var e=1;e=3e3&&(r.show=!1,m(c,"art-hide-cursor"),b(c,"art-hover"))})),e.once("ready",(function(){r.add(Ft({name:"progress",disable:i.isLive,position:"top",index:10})),r.add(Qt({name:"thumbnails",disable:!i.thumbnails.url||i.isLive,position:"top",index:20})),r.add(function(t){return function(e){return te(te({},t),{},{mounted:function(t){var r=e.player,n=x(t,''),o=x(t,'');e.on("loop",(function(e){e?(k(t,"display","block"),k(n,"left","calc(".concat(e[0]/r.duration*100,"% - ").concat(n.clientWidth,"px)")),k(o,"left","".concat(e[1]/r.duration*100,"%"))):k(t,"display","none")}))}})}}({name:"loop",disable:!1,position:"top",index:30})),r.add(function(t){return function(e){return At(At({},t),{},{mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.i18n,i=e.player,a=x(t,n.play),c=x(t,n.pause);function l(){k(a,"display","flex"),k(c,"display","none")}function s(){k(a,"display","none"),k(c,"display","flex")}R(a,o.get("Play")),R(c,o.get("Pause")),r(a,"click",(function(){i.play=!0})),r(c,"click",(function(){i.pause=!0})),i.playing?s():l(),e.on("video:playing",(function(){s()})),e.on("video:pause",(function(){l()}))}})}}({name:"playAndPause",disable:!1,position:"left",index:10})),r.add(function(t){return function(e){return Ht(Ht({},t),{},{mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.player,i=e.i18n,a=!1,c=x(t,n.volume),l=x(t,n.volumeClose),s=x(t,'
'),u=x(s,'
');function p(t){var e=s.getBoundingClientRect().left;return J(t.pageX-e-6,0,54)/48}function f(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.7;if(o.muted||0===t)k(c,"display","none"),k(l,"display","flex"),k(u,"left","0");else{var e=48*t;k(c,"display","flex"),k(l,"display","none"),k(u,"left","".concat(e,"px"))}}R(c,i.get("Mute")),k(l,"display","none"),e.isMobile&&k(s,"display","none"),f(o.volume),e.on("video:volumechange",(function(){f(o.volume)})),r(c,"click",(function(){o.muted=!0})),r(l,"click",(function(){o.muted=!1})),r(s,"click",(function(t){o.muted=!1,o.volume=p(t)})),r(u,"mousedown",(function(){a=!0})),r(t,"mousemove",(function(t){a&&(o.muted=!1,o.volume=p(t))})),r(document,"mouseup",(function(){a&&(a=!1)}))}})}}({name:"volume",disable:!1,position:"left",index:20})),r.add(function(t){return function(e){return Wt(Wt({},t),{},{mounted:function(t){function r(){var r="".concat(G(e.player.currentTime)," / ").concat(G(e.player.duration));r!==t.innerText&&(t.innerText=r)}r(),["video:loadedmetadata","video:timeupdate","video:progress"].forEach((function(t){e.on(t,r)}))}})}}({name:"time",disable:i.isLive,position:"left",index:30})),r.add(function(t){return function(e){var r=e.option.quality,n=r.find((function(t){return t.default}))||r[0];return Gt(Gt({},t),{},{html:n?n.name:"",selector:r,onSelect:function(t){e.player.switchQuality(t.url,t.name)}})}}({name:"quality",disable:0===i.quality.length,position:"right",index:10})),r.add(function(t){return function(e){return Zt(Zt({},t),{},{tooltip:e.i18n.get("Screenshot"),mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.player;x(t,n.screenshot),r(t,"click",(function(){o.screenshot()}))}})}}({name:"screenshot",disable:!i.screenshot,position:"right",index:20})),r.add(function(t){return function(e){return Bt(Bt({},t),{},{tooltip:e.i18n.get("Hide subtitle"),mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.i18n,i=e.subtitle;x(t,n.subtitle),r(t,"click",(function(){i.toggle=!0})),e.on("subtitle",(function(e){R(t,o.get(e?"Hide subtitle":"Show subtitle"))}))}})}}({name:"subtitle",disable:!i.subtitle.url,position:"right",index:30})),r.add(function(t){return function(e){return Ut(Ut({},t),{},{tooltip:e.i18n.get("Show setting"),mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.i18n,i=e.setting;x(t,n.setting),r(t,"click",(function(){i.toggle=!0})),e.on("setting",(function(e){R(t,o.get(e?"Hide setting":"Show setting"))}))}})}}({name:"setting",disable:!i.setting,position:"right",index:40})),r.add(function(t){return function(e){return Dt(Dt({},t),{},{tooltip:e.i18n.get("PIP mode"),mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.i18n,i=e.player;x(t,n.pip),r(t,"click",(function(){i.pipToggle=!0})),e.on("pip",(function(e){R(t,o.get(e?"Exit PIP mode":"PIP mode"))}))}})}}({name:"pip",disable:!i.pip,position:"right",index:50})),r.add(function(t){return function(e){return $t($t({},t),{},{tooltip:e.i18n.get("Web fullscreen"),mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.i18n,i=e.player;x(t,n.fullscreenWeb),r(t,"click",(function(){i.fullscreenWebToggle=!0})),e.on("fullscreenWeb",(function(e){R(t,o.get(e?"Exit web fullscreen":"Web fullscreen"))}))}})}}({name:"fullscreenWeb",disable:!i.fullscreenWeb,position:"right",index:60})),r.add(function(t){return function(e){return Et(Et({},t),{},{tooltip:e.i18n.get("Fullscreen"),mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.i18n,i=e.player;x(t,n.fullscreen),r(t,"click",(function(){i.fullscreenToggle=!0})),e.on("fullscreen",(function(e){R(t,o.get(e?"Exit fullscreen":"Fullscreen"))}))}})}}({name:"fullscreen",disable:!i.fullscreen,position:"right",index:70})),i.controls.forEach((function(t){r.add(t)}))})),r}return r(o,[{key:"add",value:function(t){var e="function"==typeof t?t(this.art):t,r=this.art.template,n=r.$progress,i=r.$controlsLeft,a=r.$controlsRight;switch(e.position){case"top":this.$parent=n;break;case"left":this.$parent=i;break;case"right":this.$parent=a;break;default:M(!1,"Control option.position must one of 'top', 'left', 'right'")}jt(l(o.prototype),"add",this).call(this,e)}}]),o}(Pt);function ne(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function oe(t){for(var e=1;e0.50.75').concat(r.get("Normal"),'1.251.52.0'),click:function(t,e){var r=e.target.dataset.rate;r&&(n.playbackRate=Number(r),t.show=!1)},mounted:function(t){e.on("playbackRate",(function(e){var r=g("span",t).find((function(t){return Number(t.dataset.rate)===e}));r&&E(r,"art-current")}))}})}}({disable:!i.playbackRate,name:"playbackRate",index:10})),o.add(function(t){return function(e){var r=e.i18n,n=e.player;return ae(ae({},t),{},{html:"".concat(r.get("Aspect ratio"),':').concat(r.get("Default"),'4:316:9'),click:function(t,e){var r=e.target.dataset.ratio;r&&(n.aspectRatio=r,t.show=!1)},mounted:function(t){e.on("aspectRatio",(function(e){var r=g("span",t).find((function(t){return t.dataset.ratio===e}));r&&E(r,"art-current")}))}})}}({disable:!i.aspectRatio,name:"aspectRatio",index:20})),o.add(function(t){return function(e){return le(le({},t),{},{html:e.i18n.get("Video info"),click:function(t){e.info.show=!0,t.show=!1}})}}({disable:!1,name:"info",index:30})),o.add(function(t){return ue(ue({},t),{},{html:'ArtPlayer 3.5.31'})}({disable:!1,name:"version",index:40})),o.add(function(t){return function(e){var r=e.i18n,n=e.player;return fe(fe({},t),{},{html:r.get("Light Off"),click:function(t){n.light=!n.light,t.show=!1},mounted:function(t){e.on("light",(function(e){t.innerText=r.get(e?"Light On":"Light Off")}))}})}}({disable:!i.light,name:"light",index:50})),o.add(function(t){return function(e){return he(he({},t),{},{html:e.i18n.get("Close"),click:function(t){t.show=!1}})}}({disable:!1,name:"close",index:60})),i.contextmenu.forEach((function(t){o.add(t)})),s(c,"contextmenu",(function(t){t.preventDefault(),o.show=!0;var e=t.clientX,r=t.clientY,n=c.getBoundingClientRect(),i=n.height,a=n.width,s=n.left,u=n.top,p=l.getBoundingClientRect(),f=p.height,d=p.width,h=e-s,y=r-u;e+d>s+a&&(h=a-d),r+f>u+i&&(y=i-f),j(l,{top:"".concat(y,"px"),left:"".concat(h,"px")})})),s(c,"click",(function(t){T(t,l)||(o.show=!1)})),e.on("blur",(function(){o.show=!1}))})),o}return n}(Pt);function ge(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l(t);if(e){var o=l(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var me=function(e){i(o,e);var n=ge(o);function o(e){var r;return t(this,o),(r=n.call(this,e)).art=e,r.name="info",r.art.template.$info&&r.init(),r}return r(o,[{key:"init",value:function(){var t=this,e=this.art,r=e.template,n=r.$infoPanel,o=r.$infoClose,i=r.$video;(0,e.events.proxy)(o,"click",(function(){t.show=!1}));var a=null,c=g("[data-video]",n);function l(){c.forEach((function(t){var e=i[t.dataset.video];t.innerText="number"==typeof e?e.toFixed(2):e})),a=setTimeout((function(){l()}),1e3)}this.art.on("destroy",(function(){clearTimeout(a)})),this.art.on("info",(function(t){clearTimeout(a),t&&l()}))}}]),o}(Pt);function be(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l(t);if(e){var o=l(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var we=function(e){i(o,e);var n=be(o);function o(e){var r;t(this,o),(r=n.call(this,e)).name="subtitle";var i=e.option.subtitle,a=e.template.$subtitle;return j(a,i.style),i.url&&r.init(i.url),i.bilingual&&m(a,"art-bilingual"),r}return r(o,[{key:"url",get:function(){return this.art.template.$track.src}},{key:"textTrack",get:function(){return this.art.template.$video.textTracks[0]}},{key:"activeCue",get:function(){return this.textTrack.activeCues[0]}},{key:"bilingual",get:function(){return w(this.art.template.$subtitle,"art-bilingual")},set:function(t){var e=this.art.template.$subtitle;t?m(e,"art-bilingual"):b(e,"art-bilingual")}},{key:"style",value:function(t,e){var r=this.art.template.$subtitle;return"object"===a(t)?j(r,t):k(r,t,e)}},{key:"update",value:function(){var t=this.art.template.$subtitle;t.innerHTML="",this.activeCue&&(t.innerHTML=this.activeCue.text.split(/\r?\n/).map((function(t){return"

".concat(K(t),"

")})).join(""),this.art.emit("subtitleUpdate",this.activeCue.text))}},{key:"switch",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.art,o=n.i18n,i=n.notice;return this.init(t,r).then((function(t){return r.name&&(i.show="".concat(o.get("Switch subtitle"),": ").concat(r.name)),e.art.emit("subtitleSwitch",t),t}))}},{key:"init",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.art,o=n.notice,i=n.events.proxy,a=n.option.subtitle,c=n.template,l=c.$subtitle,s=c.$video,u=c.$track;if(!u){var p=document.createElement("track");p.default=!0,p.kind="metadata",s.appendChild(p),this.art.template.$track=p,i(this.textTrack,"cuechange",this.update.bind(this))}return fetch(t).then((function(t){return t.arrayBuffer()})).then((function(n){var o=new TextDecoder(r.encoding||a.encoding).decode(n);switch(e.art.emit("subtitleLoad",t),r.ext||I(t)){case"srt":return q(F(o));case"ass":return q(B(o));case"vtt":return q(o);default:return t}})).then((function(t){return l.innerHTML="",e.url===t||(URL.revokeObjectURL(e.url),e.art.template.$track.src=t),t})).catch((function(t){throw o.show=t,t}))}}]),o}(Pt);var xe=function(){function e(r){var n=this;t(this,e),this.destroyEvents=[],this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),this.loadImg=this.loadImg.bind(this),r.whitelist.state&&r.once("ready",(function(){!function(t,e){var r=t.template.$player;e.proxy(document,["click","contextmenu"],(function(e){T(e,r)?(t.isFocus=!0,t.emit("focus")):(t.isFocus=!1,t.emit("blur"))}))}(r,n),function(t,e){var r=t.template.$player;e.hover(r,(function(){m(r,"art-hover"),t.emit("hover",!0)}),(function(){b(r,"art-hover"),t.emit("hover")}))}(r,n),function(t,e){var r=t.template.$player;e.proxy(r,"mousemove",(function(e){t.emit("mousemove",e)}))}(r,n),function(t,e){var r=t.option,n=t.player,o=Z((function(){n.normalSize&&(n.autoSize=r.autoSize),n.aspectRatioReset=!0,t.emit("resize")}),500);e.proxy(window,["orientationchange","resize"],(function(){o()}))}(r,n),function(t,e){if(t.isMobile&&!t.option.isLive){var r=t.player,n=t.notice,o=t.template.$video,i=!1,a=0,c=0;e.proxy(o,"touchstart",(function(t){1===t.touches.length&&(i=!0,a=t.touches[0].clientX)})),e.proxy(document,"touchmove",(function(t){if(1===t.touches.length&&i){var e=J((t.touches[0].clientX-a)/o.clientWidth,-1,1);c=J(r.currentTime+60*e,0,r.duration),n.show="".concat(G(c)," / ").concat(G(r.duration))}})),e.proxy(document,"touchend",(function(){i&&c&&(r.seek=c),i=!1,a=0,c=0}))}}(r,n),function(t,e){var r=t.player,n=t.option,o=t.template.$container,i=Z((function(){t.emit("view",$(o,50))}),200);e.proxy(window,"scroll",(function(){i()})),t.on("view",(function(t){n.autoMini&&(r.mini=!t)}))}(r,n)}))}return r(e,[{key:"proxy",value:function(t,e,r){var n=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(Array.isArray(e))return e.map((function(e){return n.proxy(t,e,r,o)}));t.addEventListener(e,r,o);var i=function(){return t.removeEventListener(e,r,o)};return this.destroyEvents.push(i),i}},{key:"hover",value:function(t,e,r){e&&this.proxy(t,"mouseenter",e),r&&this.proxy(t,"mouseleave",r)}},{key:"loadImg",value:function(t){var e=this;return new Promise((function(r,n){var o;if(t instanceof HTMLImageElement)o=t;else{if("string"!=typeof t)return n(new L("Unable to get Image"));(o=new Image).src=t}return o.complete||(e.proxy(o,"load",(function(){return r(o)})),e.proxy(o,"error",(function(){return n(new L("Failed to load Image: ".concat(o.src)))}))),r(o)}))}},{key:"destroy",value:function(){this.destroyEvents.forEach((function(t){return t()}))}}]),e}(),Oe=function(){function e(r){var n=this;t(this,e),this.keys={};var o=r.option,i=r.player,a=r.events.proxy;o.hotkey&&r.once("ready",(function(){n.add(27,(function(){i.fullscreenWeb&&(i.fullscreenWeb=!1)})),n.add(32,(function(){i.toggle=!0})),n.add(37,(function(){i.backward=5})),n.add(38,(function(){i.volume+=.1})),n.add(39,(function(){i.forward=5})),n.add(40,(function(){i.volume-=.1})),a(window,"keydown",(function(t){if(r.isFocus){var e=document.activeElement.tagName.toUpperCase(),o=document.activeElement.getAttribute("contenteditable");if("INPUT"!==e&&"TEXTAREA"!==e&&""!==o&&"true"!==o){var i=n.keys[t.keyCode];i&&(t.preventDefault(),i.forEach((function(t){return t.call(r)})),r.emit("hotkey",t))}}}))}))}return r(e,[{key:"add",value:function(t,e){this.keys[t]?this.keys[t].push(e):this.keys[t]=[e]}}]),e}();function ke(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l(t);if(e){var o=l(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var je=function(e){i(n,e);var r=ke(n);function n(e){var o;return t(this,n),(o=r.call(this,e)).name="layer",o.$parent=e.template.$layer,e.once("ready",(function(){e.option.layers.forEach((function(t){o.add(t)}))})),o}return n}(Pt);function Pe(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l(t);if(e){var o=l(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var Se=function(e){i(n,e);var r=Pe(n);function n(e){var o;return t(this,n),(o=r.call(this,e)).name="loading",x(e.template.$loading,e.icons.loading),o}return n}(Pt),Ee=function(){function e(r){t(this,e),this.art=r,this.time=2e3,this.timer=null}return r(e,[{key:"show",set:function(t){var e=this.art.template,r=e.$player,n=e.$noticeInner;n.innerText=t instanceof Error?t.message.trim():t,m(r,"art-notice-show"),clearTimeout(this.timer),this.timer=setTimeout((function(){n.innerText="",b(r,"art-notice-show")}),this.time)}}]),e}();function Re(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l(t);if(e){var o=l(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var $e=function(e){i(n,e);var r=Re(n);function n(e){var o;return t(this,n),(o=r.call(this,e)).name="mask",x(e.template.$state,e.icons.state),o}return n}(Pt);function Te(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}var De=function e(r){var n=this;t(this,e);var o=function(t){for(var e=1;e',state:'',play:'',pause:'',volume:'',volumeClose:'',subtitle:'',screenshot:'\t',setting:'',fullscreen:'\t\t\t\t',fullscreenWeb:'\t',pip:''},r.option.icons);Object.keys(o).forEach((function(t){N(n,t,{get:function(){var e=document.createElement("i");return m(e,"art-icon"),m(e,"art-icon-".concat(t)),x(e,o[t]),e}})}))};function ze(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Ae(t){for(var e=1;e'.concat(r.get("Flip"),'
"),click:function(t,e){var r=e.target.dataset.value;r&&(n.flip=r)},mounted:function(t){e.on("flip",(function(e){var r=g("button",t).find((function(t){return t.dataset.value===e}));r&&E(r.parentElement,"current")}))}})}}({disable:!i.flip,name:"flip"})),o.add(function(t){return function(e){var r=e.i18n,n=e.player;return Le(Le({},t),{},{html:'
'.concat(r.get("Rotate"),': 0°
'),click:function(t,e){var r=e.target.dataset.value;if(r){var o=n.rotate+Number(r);n.rotate=360===o||-360===o?0:o}else n.rotate=0},mounted:function(t){var r=v(".art-rotate-value",t);e.on("rotate",(function(t){r.innerText="".concat(t||0,"°")}))}})}}({disable:!i.rotate,name:"rotate"})),o.add(function(t){return function(e){var r=e.i18n,n=e.player;return Fe(Fe({},t),{},{html:'
'.concat(r.get("Aspect ratio"),'
'),click:function(t,e){var r=e.target.dataset.value;r&&(n.aspectRatio=r)},mounted:function(t){e.on("aspectRatio",(function(e){var r=g("button",t).find((function(t){return t.dataset.value===e}));r&&E(r.parentElement,"current")}))}})}}({disable:!i.aspectRatio,name:"aspectRatio"})),o.add(function(t){return function(e){var r=e.i18n,n=e.player,o=e.events.proxy;return Be(Be({},t),{},{html:'
'.concat(r.get("Play speed"),': 1.0x
'),mounted:function(t){var r=v(".art-setting-range input",t),i=v(".art-subtitle-value",t);o(r,"change",(function(){var t=r.value;i.innerText=t,n.playbackRate=Number(t)})),e.on("playbackRate",(function(t){t&&r.value!==t&&(r.value=t,i.innerText=t)}))}})}}({disable:!i.playbackRate,name:"playbackRate"}))})),e.on("blur",(function(){o.show=!1}))),o}return n}(Pt),Ve=function(){function e(){t(this,e),this.name="artplayer_settings",this.settings={}}return r(e,[{key:"get",value:function(t){try{var e=JSON.parse(window.localStorage.getItem(this.name))||{};return t?e[t]:e}catch(e){return t?this.settings[t]:this.settings}}},{key:"set",value:function(t,e){try{var r=Object.assign({},this.get(),et({},t,e));window.localStorage.setItem(this.name,JSON.stringify(r))}catch(r){this.settings[t]=e}}},{key:"del",value:function(t){try{var e=this.get();delete e[t],window.localStorage.setItem(this.name,JSON.stringify(e))}catch(e){delete this.settings[t]}}},{key:"clean",value:function(){try{window.localStorage.removeItem(this.name)}catch(t){this.settings={}}}}]),e}();function He(t){var e=t.i18n,r=t.subtitle,n=t.events.proxy;return{title:"Subtitle",name:"subtitleOffset",index:20,html:'
'.concat(e.get("Subtitle offset time"),': 0s
'),mounted:function(e){var o=v(".art-setting-range input",e),i=v(".art-subtitle-value",e);n(o,"change",(function(){var e=o.value;i.innerText=e,t.plugins.subtitleOffset.offset(Number(e))})),t.on("subtitle:switch",(function(){o.value=0,i.innerText=0})),t.on("subtitleOffset",(function(t){r.update(),o.value!==t&&(o.value=t,i.innerText=t)}))}}}function Ne(t){var e=t.constructor.utils.clamp,r=t.setting,n=t.notice,o=t.template,i=t.i18n,a=t.player;r.add(He);var c=[];return t.on("subtitle:switch",(function(){c=[]})),{name:"subtitleOffset",offset:function(r){if(o.$track&&o.$track.track){var l=Array.from(o.$track.track.cues),s=e(r,-5,5);l.forEach((function(t,r){c[r]||(c[r]={startTime:t.startTime,endTime:t.endTime}),t.startTime=e(c[r].startTime+s,0,a.duration),t.endTime=e(c[r].endTime+s,0,a.duration)})),n.show="".concat(i.get("Subtitle offset time"),": ").concat(r,"s"),t.emit("subtitleOffset",r)}else n.show="".concat(i.get("No subtitles found")),t.emit("subtitleOffset",0)}}}function Ue(t){var e=t.events.proxy,r=t.template,n=t.player,o=t.option,i=t.setting,a=t.i18n;function c(e){if(e){var i=r.$video.canPlayType(e.type);if("maybe"===i||"probably"===i){var a=URL.createObjectURL(e);o.title=e.name,n.switchUrl(a,e.name),t.emit("localVideo",e)}else M(!1,"Playback of this file format is not supported")}}function l(t){var r=x(t,'');k(t,"position","relative"),j(r,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(r,"change",(function(){c(r.files[0])}))}return e(r.$player,"dragover",(function(t){t.preventDefault()})),e(r.$player,"drop",(function(t){t.preventDefault(),c(t.dataTransfer.files[0])})),t.once("ready",(function(){i.add({title:"Local Video",name:"localVideo",index:30,html:'
'.concat(a.get("Local Video"),'
').concat(a.get("Open"),'
'),mounted:function(e){var r=v(".art-upload-btn",e),n=v(".art-upload-value",e);t.on("localVideo",(function(t){n.textContent=t.name,n.title=t.name})),l(r)}})})),{name:"localVideo",attach:l}}function _e(t){var e=t.events.proxy,r=t.subtitle,n=t.setting,o=t.i18n;function i(n){var o=x(n,'');k(n,"position","relative"),j(o,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(o,"change",(function(){!function(e){if(e){var n=I(e.name);["ass","vtt","srt"].includes(n)?(r.switch(URL.createObjectURL(e),{name:e.name,ext:n}),t.emit("localSubtitle",e)):M(!1,"Only supports subtitle files in .ass, .vtt and .srt format")}}(o.files[0])}))}return t.once("ready",(function(){n.add({title:"Local Subtitle",name:"localSubtitle",index:40,html:'
'.concat(o.get("Local Subtitle"),'
').concat(o.get("Open"),'
'),mounted:function(e){var r=v(".art-upload-btn",e),n=v(".art-upload-value",e);t.on("localSubtitle",(function(t){n.textContent=t.name,n.title=t.name})),i(r)}})})),{name:"localSubtitle",attach:i}}function Xe(t){var e=t.layers,r=t.player,n=t.option.theme;return e.add({name:"miniProgressBar",style:{display:"none",position:"absolute",left:0,right:0,bottom:0,height:"2px",background:n},mounted:function(e){t.on("control",(function(t){e.style.display=t?"none":"block"})),t.on("destroy",(function(){e.style.display="none"})),t.on("video:timeupdate",(function(){e.style.width="".concat(100*r.played,"%")}))}}),{name:"miniProgressBar"}}function Qe(t){var e=1e4,r=0,n=0,o=0,i=null;function a(){r=0,n=0,o=0,cancelAnimationFrame(i),i=null}function c(){i||function a(){t.isDestroy||(i=requestAnimationFrame((function(){var i=Date.now();if(o){var c=i-o;n+=c,t.player.playing||(r+=c)}o=i,t.emit("networkMonitor",r/n),n>=e&&(r=0,n=0),a()})))}()}return t.on("play",c),t.on("pause",a),{name:"networkMonitor",reset:a,start:c,sample:function(t){e=t}}}function Ye(t){var e=t.layers,r=null;e.add({name:"log",style:{bottom:"50px"},mounted:function(t){r=t}});var n=null;function o(){var e=r.childElementCount;k(r,"bottom",t.controls.show?"50px":"10px"),e?e>5?(O(r.firstElementChild),n=setTimeout(o,3e3)):n=setTimeout((function(){O(r.firstElementChild),o()}),3e3):k(r,"display","none")}return t.on("destroy",(function(){return clearTimeout(n)})),{name:"log",emit:function(t){"string"==typeof t&&(x(r,"

".concat(K(t),"

")),k(r,"display","block"),clearTimeout(n),o())}}}var Ze=function(){function e(r){var n=this;t(this,e),this.art=r,this.id=0;var o=r.option;o.subtitle.url&&o.subtitleOffset&&this.add(Ne),!o.isLive&&o.miniProgressBar&&this.add(Xe),o.localVideo&&this.add(Ue),o.localSubtitle&&this.add(_e),o.networkMonitor&&this.add(Qe),o.log&&this.add(Ye),r.option.plugins.forEach((function(t){n.add(t)}))}return r(e,[{key:"add",value:function(t){this.id+=1;var e=t.call(this,this.art),r=e&&e.name||t.name||"plugin".concat(this.id);return M(!_(this,r),"Cannot add a plugin that already has the same name: ".concat(r)),N(this,r,{value:e}),this}}]),e}(),Je=function e(r){t(this,e);var n=r.option,o=r.events.proxy,i=r.template.$video;ft.events.forEach((function(t){o(i,t,(function(t){r.emit("video:".concat(t.type),t)}))})),Object.keys(n.moreVideoAttr).forEach((function(t){i[t]=n.moreVideoAttr[t]})),n.muted&&(i.muted=n.muted),n.volume&&(i.volume=J(n.volume,0,1)),n.poster&&(i.poster=n.poster),n.autoplay&&(i.autoplay=n.autoplay),i.controls=!0;var a=n.type||I(n.url),c=n.customType[a];a&&c?(c(i,n.url,r),r.emit("customType",a)):(i.src=n.url,r.emit("url",i.src))};function Ge(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l(t);if(e){var o=l(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var Ke=0,tr=[],er=function(e){i(a,e);var o=Ge(a);function a(e){var r;return t(this,a),(r=o.call(this)).option=u(Q(a.option,e),pt),r.isFocus=!1,r.isDestroy=!1,r.userAgent=f,r.isMobile=d,r.isWechat=y,r.whitelist=new dt(n(r)),r.template=new ht(n(r)),r.events=new xe(n(r)),r.whitelist.state?(r.storage=new Ve(n(r)),r.icons=new De(n(r)),r.i18n=new gt(n(r)),r.notice=new Ee(n(r)),r.player=new Ot(n(r)),r.layers=new je(n(r)),r.controls=new re(n(r)),r.contextmenu=new ve(n(r)),r.subtitle=new we(n(r)),r.info=new me(n(r)),r.loading=new Se(n(r)),r.hotkey=new Oe(n(r)),r.mask=new $e(n(r)),r.setting=new We(n(r)),r.plugins=new Ze(n(r))):r.mobile=new Je(n(r)),Ke+=1,r.id=Ke,tr.push(n(r)),r}return r(a,[{key:"destroy",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.events.destroy(),this.template.destroy(t),tr.splice(tr.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}],[{key:"instances",get:function(){return tr}},{key:"version",get:function(){return"3.5.31"}},{key:"env",get:function(){return'"production"'}},{key:"config",get:function(){return ft}},{key:"utils",get:function(){return tt}},{key:"scheme",get:function(){return pt}},{key:"Emitter",get:function(){return p}},{key:"validator",get:function(){return u}},{key:"kindOf",get:function(){return u.kindOf}},{key:"html",get:function(){return ht.html}},{key:"option",get:function(){return{container:"#artplayer",url:"",poster:"",title:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,autoMini:!1,loop:!1,flip:!1,rotate:!1,playbackRate:!1,aspectRatio:!1,screenshot:!1,setting:!1,hotkey:!0,pip:!1,mutex:!0,light:!1,backdrop:!0,fullscreen:!1,fullscreenWeb:!1,subtitleOffset:!1,miniProgressBar:!1,localVideo:!1,localSubtitle:!1,networkMonitor:!1,useSSR:!1,layers:[],contextmenu:[],controls:[],quality:[],highlight:[],plugins:[],whitelist:[],switcher:[],thumbnails:{url:"",number:60,width:160,height:90,column:10},subtitle:{url:"",style:{},encoding:"utf-8",bilingual:!1},moreVideoAttr:{controls:!1,preload:h?"auto":"metadata"},icons:{},customType:{},lang:navigator.language.toLowerCase()}}}]),a}(p);return console.log("%c ArtPlayer %c 3.5.31 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),er})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Artplayer=e()}(this,(function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var r=0;r1?r-1:0),o=1;o1&&void 0!==arguments[1]?arguments[1]:document;return e.querySelector(t)}function g(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(e.querySelectorAll(t))}function m(t,e){return t.classList.add(e)}function b(t,e){return t.classList.remove(e)}function w(t,e){return t.classList.contains(e)}function x(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function O(t,e,r){return t.style[e]=r,t}function k(t,e){return Object.keys(e).forEach((function(r){O(t,r,e[r])})),t}function j(t,e){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=window.getComputedStyle(t,null).getPropertyValue(e);return r?parseFloat(n):n}function P(t){return Array.from(t.parentElement.children).filter((function(e){return e!==t}))}function S(t,e){P(t).forEach((function(t){return b(t,e)})),m(t,e)}function E(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"up";d||(t.setAttribute("aria-label",e),t.setAttribute("data-balloon-pos",r))}function R(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=t.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight,o=window.innerWidth||document.documentElement.clientWidth,i=r.top-e<=n&&r.top+r.height+e>=0,a=r.left-e<=o+e&&r.left+r.width+e>=0;return i&&a}function $(t,e){return t.composedPath&&t.composedPath().indexOf(e)>-1}function T(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function D(t,e,r){return D=T()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var i=new(Function.bind.apply(t,n));return r&&o(i,r.prototype),i},D.apply(null,arguments)}function z(t){var e="function"==typeof Map?new Map:void 0;return z=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return D(t,arguments,l(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),o(n,t)},z(t)}function A(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l(t);if(e){var o=l(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var C=function(e){i(o,e);var r=A(o);function o(e,i){var a;return t(this,o),a=r.call(this,e),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(n(a),i||a.constructor),a.name="ArtPlayerError",a}return o}(z(Error));function L(t,e){if(!t)throw new C(e);return t}function M(t){return"WEBVTT \r\n\r\n".concat(t.replace(/{[\s\S]*?}/g,"").replace(/\{\\([ibu])\}/g,"").replace(/\{\\([ibu])1\}/g,"<$1>").replace(/\{([ibu])\}/g,"<$1>").replace(/\{\/([ibu])\}/g,"").replace(/(\d\d:\d\d:\d\d),(\d\d\d)/g,"$1.$2").concat("\r\n\r\n"))}function F(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function q(t){var e=new RegExp("Dialogue:\\s\\d,(\\d+:\\d\\d:\\d\\d.\\d\\d),(\\d+:\\d\\d:\\d\\d.\\d\\d),([^,]*),([^,]*),(?:[^,]*,){4}([\\s\\S]*)$","i");function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return t.split(/[:.]/).map((function(t,e,r){if(e===r.length-1){if(1===t.length)return".".concat(t,"00");if(2===t.length)return".".concat(t,"0")}else if(1===t.length)return(0===e?"0":":0")+t;return 0===e?t:e===r.length-1?".".concat(t):":".concat(t)})).join("")}return"WEBVTT\n\n".concat(t.split(/\r?\n/).map((function(t){var n=t.match(e);return n?{start:r(n[1].trim()),end:r(n[2].trim()),text:n[5].replace(/{[\s\S]*?}/g,"").replace(/(\\N)/g,"\n").trim().split(/\r?\n/).map((function(t){return t.trim()})).join("\n")}:null})).filter((function(t){return t})).map((function(t,e){return t?"".concat(e+1,"\n").concat(t.start," --\x3e ").concat(t.end,"\n").concat(t.text):""})).filter((function(t){return t.trim()})).join("\n\n"))}function B(t){return t.includes("?")?B(t.split("?")[0]):t.includes("#")?B(t.split("#")[0]):t.trim().toLowerCase().split(".").pop()}function I(t,e){var r=document.createElement("a");r.style.display="none",r.href=t,r.download=e,document.body.appendChild(r),r.click(),document.body.removeChild(r)}function V(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r1?e-1:0),n=1;n0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(e){return setTimeout(e,t)}))}function Y(t,e){var r,n,o=!1;return function i(){for(var a=arguments.length,c=new Array(a),l=0;l0?[e,r,n]:[r,n]).map((function(t){return t<10?"0".concat(t):String(t)})).join(":")}function G(t){return t.replace(/[&<>'"]/g,(function(t){return{"&":"&","<":"<",">":">","'":"'",'"':"""}[t]||t}))}var K=Object.freeze({__proto__:null,query:v,queryAll:g,addClass:m,removeClass:b,hasClass:w,append:x,remove:function(t){return t.parentNode.removeChild(t)},setStyle:O,setStyles:k,getStyle:j,sublings:P,inverseClass:S,tooltip:E,isInViewport:R,includeFromEvent:$,ArtPlayerError:C,errorHandle:L,srtToVtt:M,vttToBlob:F,assToVtt:q,getExt:B,download:I,def:H,has:U,proxyPropertys:_,mergeDeep:X,sleep:Q,debounce:function(t,e,r){var n;function o(){for(var o=arguments.length,i=new Array(o),a=0;a-1;case"function":return t(r.userAgent);case"regexp":return t.test(r.userAgent);default:return!1}}))},dt=function(){function e(r){var n=this;t(this,e),this.art=r,this.art.query=this.query.bind(this),r.option.container instanceof Element?this.$container=r.option.container:(this.$container=v(r.option.container),L(this.$container,"No container element found by ".concat(r.option.container))),L(r.constructor.instances.every((function(t){return t.template.$container!==n.$container})),"Cannot mount multiple instances on the same dom element"),r.whitelist.state?this.desktop():this.mobile()}return r(e,[{key:"query",value:function(t){return v(t,this.$container)}},{key:"desktop",value:function(){var t=this.art.option,r=t.backdrop,n=t.theme;t.useSSR||(this.$container.innerHTML=e.html),this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video"),this.$poster=this.query(".art-poster"),this.$subtitle=this.query(".art-subtitle"),this.$danmuku=this.query(".art-danmuku"),this.$bottom=this.query(".art-bottom"),this.$progress=this.query(".art-progress"),this.$controls=this.query(".art-controls"),this.$controlsLeft=this.query(".art-controls-left"),this.$controlsRight=this.query(".art-controls-right"),this.$layer=this.query(".art-layers"),this.$loading=this.query(".art-loading"),this.$notice=this.query(".art-notice"),this.$noticeInner=this.query(".art-notice-inner"),this.$mask=this.query(".art-mask"),this.$state=this.query(".art-state"),this.$setting=this.query(".art-settings"),this.$settingInner=this.query(".art-setting-inner"),this.$settingBody=this.query(".art-setting-body"),this.$info=this.query(".art-info"),this.$infoPanel=this.query(".art-info-panel"),this.$infoClose=this.query(".art-info-close"),this.$miniHeader=this.query(".art-mini-header"),this.$miniTitle=this.query(".art-mini-title"),this.$miniClose=this.query(".art-mini-close"),this.$contextmenu=this.query(".art-contextmenus"),this.$player.style.setProperty("--theme",n),r&&(m(this.$settingInner,"art-backdrop-filter"),m(this.$contextmenu,"art-backdrop-filter"),m(this.$info,"art-backdrop-filter")),this.art.isMobile&&m(this.$container,"art-mobile")}},{key:"mobile",value:function(){this.$container.innerHTML='
',this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video")}},{key:"destroy",value:function(t){t?this.$container.innerHTML="":m(this.$player,"art-destroy")}}],[{key:"html",get:function(){return'
Player version:
4.0.0
Video url:
Video volume:
Video time:
Video duration:
Video resolution:
x
[x]
xD7
'}}]),e}(),ht={"Video info":"统计信息",Close:"关闭","Video load failed":"加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音",Flip:"翻转",Rotate:"旋转",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新连接","Hide subtitle":"隐藏字幕","Show subtitle":"显示字幕","Hide danmu":"隐藏弹幕","Show danmu":"显示弹幕","Show setting":"显示设置","Hide setting":"隐藏设置",Screenshot:"截图","Play speed":"播放速度","Aspect ratio":"画面比例",Default:"默认",Normal:"正常",Open:"打开","Switch video":"切换","Switch subtitle":"切换字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"网页全屏","Exit web fullscreen":"退出网页全屏","Mini player":"迷你播放器","PIP mode":"画中画模式","Exit PIP mode":"退出画中画模式","PIP not supported":"不支持画中画模式","Fullscreen not supported":"不支持全屏模式","Local Subtitle":"本地字幕","Local Video":"本地视频","Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},yt={"Video info":"統計訊息",Close:"關閉","Video load failed":"載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"翻轉",Rotate:"旋轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide subtitle":"隱藏字幕","Show subtitle":"顯示字幕","Hide danmu":"隱藏彈幕","Show danmu":"顯示彈幕","Show setting":"顯示设置","Hide setting":"隱藏设置",Screenshot:"截圖","Play speed":"播放速度","Aspect ratio":"畫面比例",Default:"默認",Normal:"正常",Open:"打開","Switch video":"切換","Switch subtitle":"切換字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"網頁全屏","Exit web fullscreen":"退出網頁全屏","Mini player":"迷你播放器","PIP mode":"畫中畫模式","Exit PIP mode":"退出畫中畫模式","PIP not supported":"不支持畫中畫模式","Fullscreen not supported":"不支持全屏模式","Local Subtitle":"本地字幕","Local Video":"本地視頻","Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"},vt=function(){function e(r){t(this,e),this.art=r,this.languages={"zh-cn":ht,"zh-tw":yt},this.init()}return r(e,[{key:"init",value:function(){var t=this.art.option.lang.toLowerCase();this.language=this.languages[t]||{}}},{key:"get",value:function(t){return this.language[t]||t}},{key:"update",value:function(t){this.languages=X(this.languages,t),this.init()}}]),e}();var gt={exports:{}};!function(t){!function(){var e="undefined"!=typeof window&&void 0!==window.document?window.document:{},r=t.exports,n=function(){for(var t,r=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],n=0,o=r.length,i={};nd){var h=d*s/l;O(n,"width","".concat(100*h,"%")),O(n,"height","100%"),O(n,"padding","0 ".concat((u-u*h)/2,"px"))}else{var y=l/d/s;O(n,"width","100%"),O(n,"height","".concat(100*y,"%")),O(n,"padding","".concat((p-p*y)/2,"px 0"))}o.dataset.aspectRatio=e}a.show="".concat(i.get("Aspect ratio"),": ").concat("default"===e?i.get("Default"):e),t.emit("aspectRatio",e)}}),H(e,"aspectRatioReset",{set:function(t){if(t&&e.aspectRatio){var r=e.aspectRatio;e.aspectRatio=r}}})}(r,this),function(t,e){var r=t.option,n=t.notice,o=t.template.$video,i=document.createElement("canvas");H(e,"getDataURL",{value:function(){return new Promise((function(t,e){try{i.width=o.videoWidth,i.height=o.videoHeight,i.getContext("2d").drawImage(o,0,0),t(i.toDataURL("image/png"))}catch(t){n.show=t,e(t)}}))}}),H(e,"getBlobUrl",{value:function(){return new Promise((function(t,e){try{i.width=o.videoWidth,i.height=o.videoHeight,i.getContext("2d").drawImage(o,0,0),i.toBlob((function(e){t(URL.createObjectURL(e))}))}catch(t){n.show=t,e(t)}}))}}),H(e,"screenshot",{value:function(){e.getDataURL().then((function(e){I(e,"".concat(r.title||"artplayer","_").concat(J(o.currentTime),".png")),t.emit("screenshot",e)}))}})}(r,this),bt(r,this),function(t,e){var r=t.template.$player;H(e,"fullscreenWeb",{get:function(){return w(r,"art-fullscreen-web")},set:function(n){n?(m(r,"art-fullscreen-web"),e.aspectRatioReset=!0,t.emit("resize"),t.emit("fullscreenWeb",!0)):(b(r,"art-fullscreen-web"),e.aspectRatioReset=!0,e.autoSize=t.option.autoSize,t.emit("resize"),t.emit("fullscreenWeb"))}}),H(e,"fullscreenWebToggle",{set:function(t){t&&(e.fullscreenWeb=!e.fullscreenWeb)}})}(r,this),wt(r,this),function(t,e){var r=t.template.$video;H(e,"loaded",{get:function(){return e.loadedTime/r.duration}}),H(e,"loadedTime",{get:function(){return r.buffered.length?r.buffered.end(r.buffered.length-1):0}})}(r,this),function(t,e){H(e,"played",{get:function(){return e.currentTime/e.duration}})}(0,this),function(t,e){var r=t.template.$video;H(e,"playing",{get:function(){return!!(r.currentTime>0&&!r.paused&&!r.ended&&r.readyState>2)}})}(r,this),function(t,e){var r=t.template,n=r.$container,o=r.$player,i=r.$video;H(e,"autoSize",{get:function(){return w(n,"art-auto-size")},set:function(r){if(r){var a=i.videoWidth,c=i.videoHeight,l=n.getBoundingClientRect(),s=l.width,u=l.height,p=a/c,f=s/u;if(m(n,"art-auto-size"),f>p)O(o,"width","".concat(u*p/s*100,"%")),O(o,"height","100%");else{var d=s/p/u*100;O(o,"width","100%"),O(o,"height","".concat(d,"%"))}t.emit("autoSize",{width:e.width,height:e.height})}else b(n,"art-auto-size"),O(o,"width",null),O(o,"height",null),t.emit("autoSize")}})}(r,this),function(t,e){H(e,"rect",{get:function(){return t.template.$player.getBoundingClientRect()}}),["bottom","height","left","right","top","width"].forEach((function(t){H(e,t,{get:function(){return e.rect[t]}})})),H(e,"x",{get:function(){return e.left+window.pageXOffset}}),H(e,"y",{get:function(){return e.top+window.pageYOffset}})}(r,this),function(t,e){var r=t.template.$player,n=t.i18n,o=t.notice;H(e,"flip",{get:function(){return r.dataset.flip},set:function(i){i||(i="normal");var a=["normal","horizontal","vertical"];L(a.includes(i),"'flip' only accept ".concat(a.toString()," as parameters")),"normal"===i?delete r.dataset.flip:(e.rotate=!1,r.dataset.flip=i);var c=i.replace(i[0],i[0].toUpperCase());o.show="".concat(n.get("Flip"),": ").concat(n.get(c)),t.emit("flip",i)}}),H(e,"flipReset",{set:function(t){if(t&&e.flip){var r=e.flip;e.flip=r}}})}(r,this),function(t,e){var r=t.i18n,n=t.option,o=t.storage,i=t.events.proxy,a=t.template,c=a.$player,l=a.$miniClose,s=a.$miniTitle,u=a.$miniHeader,p="",f=!1,d=0,h=0,y=0,v=0;i(u,"mousedown",(function(t){f=!0,d=t.pageX,h=t.pageY,y=e.left,v=e.top})),i(document,"mousemove",(function(t){if(f){m(c,"art-is-dragging");var e=v+t.pageY-h,r=y+t.pageX-d;O(c,"top","".concat(e,"px")),O(c,"left","".concat(r,"px")),o.set("top",e),o.set("left",r)}})),i(document,"mouseup",(function(){f=!1,b(c,"art-is-dragging")})),i(l,"click",(function(){e.mini=!1,f=!1,b(c,"art-is-dragging")})),x(s,n.title||r.get("Mini player")),H(e,"mini",{get:function(){return w(c,"art-mini")},set:function(r){if(r){e.autoSize=!1,p=c.style.cssText,m(c,"art-mini");var i=o.get("top"),a=o.get("left");if(i&&a)O(c,"top","".concat(i,"px")),O(c,"left","".concat(a,"px")),R(u)||(o.del("top"),o.del("left"),e.mini=!0);else{var l=document.body,s=l.clientHeight-e.height-50,f=l.clientWidth-e.width-50;o.set("top",s),o.set("left",f),O(c,"top","".concat(s,"px")),O(c,"left","".concat(f,"px"))}e.aspectRatio=!1,e.playbackRate=!1,t.emit("mini",!0)}else c.style.cssText=p,b(c,"art-mini"),O(c,"top",null),O(c,"left",null),e.aspectRatio=!1,e.playbackRate=!1,e.autoSize=n.autoSize,t.emit("mini")}}),H(e,"miniToggle",{set:function(t){t&&(e.mini=!e.mini)}})}(r,this),function(t,e){var r=[];H(e,"loop",{get:function(){return r},set:function(n){if(Array.isArray(n)&&"number"==typeof n[0]&&"number"==typeof n[1]){var o=Z(n[0],0,Math.min(n[1],e.duration)),i=Z(n[1],o,e.duration);i-o>=1?(r=[o,i],t.emit("loop",r)):(r=[],t.emit("loop"))}else r=[],t.emit("loop")}}),t.on("video:timeupdate",(function(){r.length&&(e.currentTimer[1])&&(e.seek=r[0])}))}(r,this),function(t,e){var r=t.template,n=r.$video,o=r.$player,i=t.i18n,a=t.notice;H(e,"rotate",{get:function(){return Number(o.dataset.rotate)||0},set:function(r){r||(r=0);var c=[-270,-180,-90,0,90,180,270];if(L(c.includes(r),"'rotate' only accept ".concat(c.toString()," as parameters")),0===r)delete o.dataset.rotate,O(n,"transform",null);else{e.flip=!1,t.autoSize=!0,o.dataset.rotate=r;var l=function(){var t=n.videoWidth,e=n.videoHeight;return t>e?e/t:t/e},s=0,u=1;switch(r){case-270:s=90,u=l();break;case-180:s=180;break;case-90:s=270,u=l();break;case 90:s=90,u=l();break;case 180:s=180;break;case 270:s=270,u=l()}O(n,"transform","rotate(".concat(s,"deg) scale(").concat(u,")"))}a.show="".concat(i.get("Rotate"),": ").concat(r,"°"),t.emit("rotate",r)}}),H(e,"rotateReset",{set:function(t){if(t&&e.rotate){var r=e.rotate;e.rotate=r}}})}(r,this),function(t,e){var r=t.option,n=t.template.$poster;H(e,"poster",{get:function(){return r.poster},set:function(t){r.poster=t,O(n,"backgroundImage","url(".concat(t,")"))}})}(r,this),_(r,this)};function Ot(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=l(t)););return t}function kt(){return kt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=Ot(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(arguments.length<3?t:r):o.value}},kt.apply(this,arguments)}var jt=function(){function e(r){t(this,e),this.id=0,this.art=r,this.add=this.add.bind(this)}return r(e,[{key:"show",get:function(){return w(this.art.template.$player,"art-".concat(this.name,"-show"))},set:function(t){var e=this.art.template.$player,r="art-".concat(this.name,"-show");t?m(e,r):b(e,r),this.art.emit(this.name,t)}},{key:"toggle",set:function(t){t&&(this.show=!this.show)}},{key:"add",value:function(t){var e=this,r="function"==typeof t?t(this.art):t;if(this.$parent&&this.name&&!r.disable){var n=r.name||"".concat(this.name).concat(this.id);L(!U(this,n),"Cannot add an existing name [".concat(n,"] to the [").concat(this.name,"]")),this.id+=1;var o=document.createElement("div");m(o,"art-".concat(this.name)),m(o,"art-".concat(this.name,"-").concat(n));var i=Array.from(this.$parent.children);o.dataset.index=r.index||this.id;var a=i.find((function(t){return Number(t.dataset.index)>=Number(o.dataset.index)}));a?a.insertAdjacentElement("beforebegin",o):x(this.$parent,o),r.html&&x(o,r.html),r.style&&k(o,r.style),r.tooltip&&E(o,r.tooltip),r.click&&this.art.events.proxy(o,"click",(function(t){t.preventDefault(),r.click.call(e.art,e,t)})),r.selector&&["left","right"].includes(r.position)&&this.selector(r,o),r.mounted&&r.mounted.call(this.art,o),1===o.childNodes.length&&3===o.childNodes[0].nodeType&&m(o,"art-control-onlyText"),H(this,n,{value:o})}}},{key:"selector",value:function(t,e){var r=this,n=this.art.events,o=n.hover,i=n.proxy;m(e,"art-control-selector");var a=document.createElement("div");m(a,"art-selector-value"),x(a,t.html),e.innerText="",x(e,a);var c=t.selector.map((function(t,e){return'
').concat(t.html,"
")})).join(""),l=document.createElement("div");m(l,"art-selector-list"),x(l,c),x(e,l);var s=function(){var t=j(e,"width")/2-j(l,"width")/2;l.style.left="".concat(t,"px")};o(e,s),i(l,"click",(function(e){var n=(e.composedPath()||[]).find((function(t){return w(t,"art-selector-item")}));if(n){var o=Number(n.dataset.index),i=t.selector[o]||{};if(a.innerText=n.innerText,t.onSelect){var c=t.onSelect.call(r.art,i,n);"string"==typeof c&&(a.innerHTML=c)}s(),r.art.emit("selector",i,n)}}))}}]),e}();function Pt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function St(t){for(var e=1;e
'),mounted:function(t){var r=!1,o=v(".art-progress-loaded",t),c=v(".art-progress-played",t),l=v(".art-progress-highlight",t),s=v(".art-progress-indicator",t),u=v(".art-progress-tip",t);function p(t,e){"loaded"===t&&O(o,"width","".concat(100*e,"%")),"played"===t&&(O(c,"width","".concat(100*e,"%")),O(s,"left","calc(".concat(100*e,"% - ").concat(j(s,"width")/2,"px)")))}n.forEach((function(t){var e=Z(t.time,0,a.duration)/a.duration*100;x(l,''))})),p("loaded",a.loaded),e.on("video:progress",(function(){p("loaded",a.loaded)})),e.on("video:timeupdate",(function(){p("played",a.played)})),e.on("video:ended",(function(){p("played",1)})),i(t,"mousemove",(function(r){O(u,"display","block"),$(r,l)?function(r){var n=Lt(e,r).width,o=r.target.dataset.text;u.innerHTML=o;var i=u.clientWidth;n<=i/2?O(u,"left",0):n>t.clientWidth-i/2?O(u,"left","".concat(t.clientWidth-i,"px")):O(u,"left","".concat(n-i/2,"px"))}(r):function(r){var n=Lt(e,r),o=n.width,i=n.time;u.innerHTML=i;var a=u.clientWidth;o<=a/2?O(u,"left",0):o>t.clientWidth-a/2?O(u,"left","".concat(t.clientWidth-a,"px")):O(u,"left","".concat(o-a/2,"px"))}(r)})),i(t,"mouseout",(function(){O(u,"display","none")})),i(t,"click",(function(t){if(t.target!==s){var r=Lt(e,t),n=r.second;p("played",r.percentage),a.seek=n}})),i(s,"mousedown",(function(){r=!0})),i(document,"mousemove",(function(t){if(r){var n=Lt(e,t),o=n.second,i=n.percentage;m(s,"art-show-indicator"),p("played",i),a.seek=o}})),i(document,"mouseup",(function(){r&&(r=!1,b(s,"art-show-indicator"))}))}})}}function Ft(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function qt(t){for(var e=1;en.clientWidth-l/2?O(t,"left","".concat(n.clientWidth-l,"px")):O(t,"left","".concat(i-l/2,"px"))}(o))})),i(n,"mouseout",(function(){O(t,"display","none")}))}})}}function Qt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Yt(t){for(var e=1;e=3e3&&(r.show=!1,m(c,"art-hide-cursor"),b(c,"art-hover"))})),e.once("ready",(function(){r.add(Mt({name:"progress",disable:i.isLive,position:"top",index:10})),r.add(Xt({name:"thumbnails",disable:!i.thumbnails.url||i.isLive,position:"top",index:20})),r.add(function(t){return function(e){return Kt(Kt({},t),{},{mounted:function(t){var r=e.player,n=x(t,''),o=x(t,'');e.on("loop",(function(e){e?(O(t,"display","block"),O(n,"left","calc(".concat(e[0]/r.duration*100,"% - ").concat(n.clientWidth,"px)")),O(o,"left","".concat(e[1]/r.duration*100,"%"))):O(t,"display","none")}))}})}}({name:"loop",disable:!1,position:"top",index:30})),r.add(function(t){return function(e){return zt(zt({},t),{},{mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.i18n,i=e.player,a=x(t,n.play),c=x(t,n.pause);function l(){O(a,"display","flex"),O(c,"display","none")}function s(){O(a,"display","none"),O(c,"display","flex")}E(a,o.get("Play")),E(c,o.get("Pause")),r(a,"click",(function(){i.play()})),r(c,"click",(function(){i.pause()})),i.playing?s():l(),e.on("video:playing",(function(){s()})),e.on("video:pause",(function(){l()}))}})}}({name:"playAndPause",disable:!1,position:"left",index:10})),r.add(function(t){return function(e){return Wt(Wt({},t),{},{mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.player,i=e.i18n,a=!1,c=x(t,n.volume),l=x(t,n.volumeClose),s=x(t,'
'),u=x(s,'
');function p(t){var e=s.getBoundingClientRect().left;return Z(t.pageX-e-6,0,54)/48}function f(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.7;if(o.muted||0===t)O(c,"display","none"),O(l,"display","flex"),O(u,"left","0");else{var e=48*t;O(c,"display","flex"),O(l,"display","none"),O(u,"left","".concat(e,"px"))}}E(c,i.get("Mute")),O(l,"display","none"),e.isMobile&&O(s,"display","none"),f(o.volume),e.on("video:volumechange",(function(){f(o.volume)})),r(c,"click",(function(){o.muted=!0})),r(l,"click",(function(){o.muted=!1})),r(s,"click",(function(t){o.muted=!1,o.volume=p(t)})),r(u,"mousedown",(function(){a=!0})),r(t,"mousemove",(function(t){a&&(o.muted=!1,o.volume=p(t))})),r(document,"mouseup",(function(){a&&(a=!1)}))}})}}({name:"volume",disable:!1,position:"left",index:20})),r.add(function(t){return function(e){return It(It({},t),{},{mounted:function(t){function r(){var r="".concat(J(e.player.currentTime)," / ").concat(J(e.player.duration));r!==t.innerText&&(t.innerText=r)}r(),["video:loadedmetadata","video:timeupdate","video:progress"].forEach((function(t){e.on(t,r)}))}})}}({name:"time",disable:i.isLive,position:"left",index:30})),r.add(function(t){return function(e){var r=e.option.quality,n=r.find((function(t){return t.default}))||r[0];return Jt(Jt({},t),{},{html:n?n.html:"",selector:r,onSelect:function(t){e.player.switchQuality(t.url,t.html)}})}}({name:"quality",disable:0===i.quality.length,position:"right",index:10})),r.add(function(t){return function(e){return Yt(Yt({},t),{},{tooltip:e.i18n.get("Screenshot"),mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.player;x(t,n.screenshot),r(t,"click",(function(){o.screenshot()}))}})}}({name:"screenshot",disable:!i.screenshot,position:"right",index:20})),r.add(function(t){return function(e){return qt(qt({},t),{},{tooltip:e.i18n.get("Hide subtitle"),mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.i18n,i=e.subtitle;x(t,n.subtitle),r(t,"click",(function(){i.toggle=!0})),e.on("subtitle",(function(e){E(t,o.get(e?"Hide subtitle":"Show subtitle"))}))}})}}({name:"subtitle",disable:!i.subtitle.url,position:"right",index:30})),r.add(function(t){return function(e){return Nt(Nt({},t),{},{tooltip:e.i18n.get("Show setting"),mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.i18n,i=e.setting;x(t,n.setting),r(t,"click",(function(){i.toggle=!0})),e.on("setting",(function(e){E(t,o.get(e?"Hide setting":"Show setting"))}))}})}}({name:"setting",disable:!i.setting,position:"right",index:40})),r.add(function(t){return function(e){return Tt(Tt({},t),{},{tooltip:e.i18n.get("PIP mode"),mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.i18n,i=e.player;x(t,n.pip),r(t,"click",(function(){i.pipToggle=!0})),e.on("pip",(function(e){E(t,o.get(e?"Exit PIP mode":"PIP mode"))}))}})}}({name:"pip",disable:!i.pip,position:"right",index:50})),r.add(function(t){return function(e){return Rt(Rt({},t),{},{tooltip:e.i18n.get("Web fullscreen"),mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.i18n,i=e.player;x(t,n.fullscreenWeb),r(t,"click",(function(){i.fullscreenWebToggle=!0})),e.on("fullscreenWeb",(function(e){E(t,o.get(e?"Exit web fullscreen":"Web fullscreen"))}))}})}}({name:"fullscreenWeb",disable:!i.fullscreenWeb,position:"right",index:60})),r.add(function(t){return function(e){return St(St({},t),{},{tooltip:e.i18n.get("Fullscreen"),mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.i18n,i=e.player;x(t,n.fullscreen),r(t,"click",(function(){i.fullscreenToggle=!0})),e.on("fullscreen",(function(e){E(t,o.get(e?"Exit fullscreen":"Fullscreen"))}))}})}}({name:"fullscreen",disable:!i.fullscreen,position:"right",index:70})),i.controls.forEach((function(t){r.add(t)}))})),r}return r(o,[{key:"add",value:function(t){var e="function"==typeof t?t(this.art):t,r=this.art.template,n=r.$progress,i=r.$controlsLeft,a=r.$controlsRight;switch(e.position){case"top":this.$parent=n;break;case"left":this.$parent=i;break;case"right":this.$parent=a;break;default:L(!1,"Control option.position must one of 'top', 'left', 'right'")}kt(l(o.prototype),"add",this).call(this,e)}}]),o}(jt);function re(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ne(t){for(var e=1;e0.50.75').concat(r.get("Normal"),'1.251.52.0'),click:function(t,e){var r=e.target.dataset.rate;r&&(n.playbackRate=Number(r),t.show=!1)},mounted:function(t){e.on("playbackRate",(function(e){var r=g("span",t).find((function(t){return Number(t.dataset.rate)===e}));r&&S(r,"art-current")}))}})}}({disable:!i.playbackRate,name:"playbackRate",index:10})),o.add(function(t){return function(e){var r=e.i18n,n=e.player;return ie(ie({},t),{},{html:"".concat(r.get("Aspect ratio"),':').concat(r.get("Default"),'4:316:9'),click:function(t,e){var r=e.target.dataset.ratio;r&&(n.aspectRatio=r,t.show=!1)},mounted:function(t){e.on("aspectRatio",(function(e){var r=g("span",t).find((function(t){return t.dataset.ratio===e}));r&&S(r,"art-current")}))}})}}({disable:!i.aspectRatio,name:"aspectRatio",index:20})),o.add(function(t){return function(e){return ce(ce({},t),{},{html:e.i18n.get("Video info"),click:function(t){e.info.show=!0,t.show=!1}})}}({disable:!1,name:"info",index:30})),o.add(function(t){return se(se({},t),{},{html:'ArtPlayer 4.0.0'})}({disable:!1,name:"version",index:40})),o.add(function(t){return function(e){return pe(pe({},t),{},{html:e.i18n.get("Close"),click:function(t){t.show=!1}})}}({disable:!1,name:"close",index:60})),i.contextmenu.forEach((function(t){o.add(t)})),s(c,"contextmenu",(function(t){t.preventDefault(),o.show=!0;var e=t.clientX,r=t.clientY,n=c.getBoundingClientRect(),i=n.height,a=n.width,s=n.left,u=n.top,p=l.getBoundingClientRect(),f=p.height,d=p.width,h=e-s,y=r-u;e+d>s+a&&(h=a-d),r+f>u+i&&(y=i-f),k(l,{top:"".concat(y,"px"),left:"".concat(h,"px")})})),s(c,"click",(function(t){$(t,l)||(o.show=!1)})),e.on("blur",(function(){o.show=!1}))})),o}return n}(jt);function he(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l(t);if(e){var o=l(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var ye=function(e){i(o,e);var n=he(o);function o(e){var r;return t(this,o),(r=n.call(this,e)).art=e,r.name="info",r.art.template.$info&&r.init(),r}return r(o,[{key:"init",value:function(){var t=this,e=this.art,r=e.template,n=r.$infoPanel,o=r.$infoClose,i=r.$video;(0,e.events.proxy)(o,"click",(function(){t.show=!1}));var a=null,c=g("[data-video]",n);function l(){c.forEach((function(t){var e=i[t.dataset.video];t.innerText="number"==typeof e?e.toFixed(2):e})),a=setTimeout((function(){l()}),1e3)}this.art.on("destroy",(function(){clearTimeout(a)})),this.art.on("info",(function(t){clearTimeout(a),t&&l()}))}}]),o}(jt);function ve(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l(t);if(e){var o=l(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var ge=function(e){i(o,e);var n=ve(o);function o(e){var r;t(this,o),(r=n.call(this,e)).name="subtitle";var i=e.option.subtitle,a=e.template.$subtitle;return k(a,i.style),i.url&&r.init(i.url),i.bilingual&&m(a,"art-bilingual"),r}return r(o,[{key:"url",get:function(){return this.art.template.$track.src}},{key:"textTrack",get:function(){return this.art.template.$video.textTracks[0]}},{key:"activeCue",get:function(){return this.textTrack.activeCues[0]}},{key:"bilingual",get:function(){return w(this.art.template.$subtitle,"art-bilingual")},set:function(t){var e=this.art.template.$subtitle;t?m(e,"art-bilingual"):b(e,"art-bilingual")}},{key:"style",value:function(t,e){var r=this.art.template.$subtitle;return"object"===a(t)?k(r,t):O(r,t,e)}},{key:"update",value:function(){var t=this.art.template.$subtitle;t.innerHTML="",this.activeCue&&(t.innerHTML=this.activeCue.text.split(/\r?\n/).map((function(t){return"

".concat(G(t),"

")})).join(""),this.art.emit("subtitleUpdate",this.activeCue.text))}},{key:"switch",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.art,o=n.i18n,i=n.notice;return this.init(t,r).then((function(t){return r.name&&(i.show="".concat(o.get("Switch subtitle"),": ").concat(r.name)),e.art.emit("subtitleSwitch",t),t}))}},{key:"init",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.art,o=n.notice,i=n.events.proxy,a=n.option.subtitle,c=n.template,l=c.$subtitle,s=c.$video,u=c.$track;if(!u){var p=document.createElement("track");p.default=!0,p.kind="metadata",s.appendChild(p),this.art.template.$track=p,i(this.textTrack,"cuechange",this.update.bind(this))}return fetch(t).then((function(t){return t.arrayBuffer()})).then((function(n){var o=new TextDecoder(r.encoding||a.encoding).decode(n);switch(e.art.emit("subtitleLoad",t),r.ext||B(t)){case"srt":return F(M(o));case"ass":return F(q(o));case"vtt":return F(o);default:return t}})).then((function(t){return l.innerHTML="",e.url===t||(URL.revokeObjectURL(e.url),e.art.template.$track.src=t),t})).catch((function(t){throw o.show=t,t}))}}]),o}(jt);var me=function(){function e(r){var n=this;t(this,e),this.destroyEvents=[],this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),this.loadImg=this.loadImg.bind(this),r.whitelist.state&&r.once("ready",(function(){!function(t,e){var r=t.template.$player;e.proxy(document,["click","contextmenu"],(function(e){$(e,r)?(t.isFocus=!0,t.emit("focus")):(t.isFocus=!1,t.emit("blur"))}))}(r,n),function(t,e){var r=t.template.$player;e.hover(r,(function(){m(r,"art-hover"),t.emit("hover",!0)}),(function(){b(r,"art-hover"),t.emit("hover")}))}(r,n),function(t,e){var r=t.template.$player;e.proxy(r,"mousemove",(function(e){t.emit("mousemove",e)}))}(r,n),function(t,e){var r=t.option,n=t.player,o=Y((function(){n.normalSize&&(n.autoSize=r.autoSize),n.aspectRatioReset=!0,t.emit("resize")}),500);e.proxy(window,["orientationchange","resize"],(function(){o()}))}(r,n),function(t,e){if(t.isMobile&&!t.option.isLive){var r=t.player,n=t.notice,o=t.template.$video,i=!1,a=0,c=0;e.proxy(o,"touchstart",(function(t){1===t.touches.length&&(i=!0,a=t.touches[0].clientX)})),e.proxy(document,"touchmove",(function(t){if(1===t.touches.length&&i){var e=Z((t.touches[0].clientX-a)/o.clientWidth,-1,1);c=Z(r.currentTime+60*e,0,r.duration),n.show="".concat(J(c)," / ").concat(J(r.duration))}})),e.proxy(document,"touchend",(function(){i&&c&&(r.seek=c),i=!1,a=0,c=0}))}}(r,n),function(t,e){var r=t.player,n=t.option,o=t.template.$container,i=Y((function(){t.emit("view",R(o,50))}),200);e.proxy(window,"scroll",(function(){i()})),t.on("view",(function(t){n.autoMini&&(r.mini=!t)}))}(r,n)}))}return r(e,[{key:"proxy",value:function(t,e,r){var n=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(Array.isArray(e))return e.map((function(e){return n.proxy(t,e,r,o)}));t.addEventListener(e,r,o);var i=function(){return t.removeEventListener(e,r,o)};return this.destroyEvents.push(i),i}},{key:"hover",value:function(t,e,r){e&&this.proxy(t,"mouseenter",e),r&&this.proxy(t,"mouseleave",r)}},{key:"loadImg",value:function(t){var e=this;return new Promise((function(r,n){var o;if(t instanceof HTMLImageElement)o=t;else{if("string"!=typeof t)return n(new C("Unable to get Image"));(o=new Image).src=t}return o.complete||(e.proxy(o,"load",(function(){return r(o)})),e.proxy(o,"error",(function(){return n(new C("Failed to load Image: ".concat(o.src)))}))),r(o)}))}},{key:"destroy",value:function(){this.destroyEvents.forEach((function(t){return t()}))}}]),e}(),be=function(){function e(r){var n=this;t(this,e),this.keys={};var o=r.option,i=r.player,a=r.events.proxy;o.hotkey&&r.once("ready",(function(){n.add(27,(function(){i.fullscreenWeb&&(i.fullscreenWeb=!1)})),n.add(32,(function(){i.toggle()})),n.add(37,(function(){i.backward=5})),n.add(38,(function(){i.volume+=.1})),n.add(39,(function(){i.forward=5})),n.add(40,(function(){i.volume-=.1})),a(window,"keydown",(function(t){if(r.isFocus){var e=document.activeElement.tagName.toUpperCase(),o=document.activeElement.getAttribute("contenteditable");if("INPUT"!==e&&"TEXTAREA"!==e&&""!==o&&"true"!==o){var i=n.keys[t.keyCode];i&&(t.preventDefault(),i.forEach((function(t){return t.call(r)})),r.emit("hotkey",t))}}}))}))}return r(e,[{key:"add",value:function(t,e){this.keys[t]?this.keys[t].push(e):this.keys[t]=[e]}}]),e}();function we(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l(t);if(e){var o=l(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var xe=function(e){i(n,e);var r=we(n);function n(e){var o;return t(this,n),(o=r.call(this,e)).name="layer",o.$parent=e.template.$layer,e.once("ready",(function(){e.option.layers.forEach((function(t){o.add(t)}))})),o}return n}(jt);function Oe(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l(t);if(e){var o=l(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var ke=function(e){i(n,e);var r=Oe(n);function n(e){var o;return t(this,n),(o=r.call(this,e)).name="loading",x(e.template.$loading,e.icons.loading),o}return n}(jt),je=function(){function e(r){t(this,e),this.art=r,this.time=2e3,this.timer=null}return r(e,[{key:"show",set:function(t){var e=this.art.template,r=e.$player,n=e.$noticeInner;if(!t)return b(r,"art-notice-show");n.innerText=t instanceof Error?t.message.trim():t,m(r,"art-notice-show"),clearTimeout(this.timer),this.timer=setTimeout((function(){n.innerText="",b(r,"art-notice-show")}),this.time)}}]),e}();function Pe(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l(t);if(e){var o=l(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var Se=function(e){i(n,e);var r=Pe(n);function n(e){var o;return t(this,n),(o=r.call(this,e)).name="mask",x(e.template.$state,e.icons.state),o}return n}(jt);function Ee(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}var Re=function e(r){var n=this;t(this,e);var o=function(t){for(var e=1;e',state:'',play:'',pause:'',volume:'',volumeClose:'',subtitle:'',screenshot:'\t',setting:'',fullscreen:'\t\t\t\t',fullscreenWeb:'\t',pip:''},r.option.icons);Object.keys(o).forEach((function(t){H(n,t,{get:function(){var e=document.createElement("i");return m(e,"art-icon"),m(e,"art-icon-".concat(t)),x(e,o[t]),e}})}))};function $e(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Te(t){for(var e=1;e'.concat(r.get("Flip"),'
"),click:function(t,e){var r=e.target.dataset.value;r&&(n.flip=r)},mounted:function(t){e.on("flip",(function(e){var r=g("button",t).find((function(t){return t.dataset.value===e}));r&&S(r.parentElement,"current")}))}})}}({disable:!i.flip,name:"flip"})),o.add(function(t){return function(e){var r=e.i18n,n=e.player;return ze(ze({},t),{},{html:'
'.concat(r.get("Rotate"),': 0°
'),click:function(t,e){var r=e.target.dataset.value;if(r){var o=n.rotate+Number(r);n.rotate=360===o||-360===o?0:o}else n.rotate=0},mounted:function(t){var r=v(".art-rotate-value",t);e.on("rotate",(function(t){r.innerText="".concat(t||0,"°")}))}})}}({disable:!i.rotate,name:"rotate"})),o.add(function(t){return function(e){var r=e.i18n,n=e.player;return Ce(Ce({},t),{},{html:'
'.concat(r.get("Aspect ratio"),'
'),click:function(t,e){var r=e.target.dataset.value;r&&(n.aspectRatio=r)},mounted:function(t){e.on("aspectRatio",(function(e){var r=g("button",t).find((function(t){return t.dataset.value===e}));r&&S(r.parentElement,"current")}))}})}}({disable:!i.aspectRatio,name:"aspectRatio"})),o.add(function(t){return function(e){var r=e.i18n,n=e.player,o=e.events.proxy;return Me(Me({},t),{},{html:'
'.concat(r.get("Play speed"),': 1.0x
'),mounted:function(t){var r=v(".art-setting-range input",t),i=v(".art-subtitle-value",t);o(r,"change",(function(){var t=r.value;i.innerText=t,n.playbackRate=Number(t)})),e.on("playbackRate",(function(t){t&&r.value!==t&&(r.value=t,i.innerText=t)}))}})}}({disable:!i.playbackRate,name:"playbackRate"}))})),e.on("blur",(function(){o.show=!1}))),o}return n}(jt),Be=function(){function e(){t(this,e),this.name="artplayer_settings",this.settings={}}return r(e,[{key:"get",value:function(t){try{var e=JSON.parse(window.localStorage.getItem(this.name))||{};return t?e[t]:e}catch(e){return t?this.settings[t]:this.settings}}},{key:"set",value:function(t,e){try{var r=Object.assign({},this.get(),tt({},t,e));window.localStorage.setItem(this.name,JSON.stringify(r))}catch(r){this.settings[t]=e}}},{key:"del",value:function(t){try{var e=this.get();delete e[t],window.localStorage.setItem(this.name,JSON.stringify(e))}catch(e){delete this.settings[t]}}},{key:"clean",value:function(){try{window.localStorage.removeItem(this.name)}catch(t){this.settings={}}}}]),e}();function Ie(t){var e=t.i18n,r=t.subtitle,n=t.events.proxy;return{title:"Subtitle",name:"subtitleOffset",index:20,html:'
'.concat(e.get("Subtitle offset time"),': 0s
'),mounted:function(e){var o=v(".art-setting-range input",e),i=v(".art-subtitle-value",e);n(o,"change",(function(){var e=o.value;i.innerText=e,t.plugins.subtitleOffset.offset(Number(e))})),t.on("subtitle:switch",(function(){o.value=0,i.innerText=0})),t.on("subtitleOffset",(function(t){r.update(),o.value!==t&&(o.value=t,i.innerText=t)}))}}}function Ve(t){var e=t.constructor.utils.clamp,r=t.setting,n=t.notice,o=t.template,i=t.i18n,a=t.player;r.add(Ie);var c=[];return t.on("subtitle:switch",(function(){c=[]})),{name:"subtitleOffset",offset:function(r){if(o.$track&&o.$track.track){var l=Array.from(o.$track.track.cues),s=e(r,-5,5);l.forEach((function(t,r){c[r]||(c[r]={startTime:t.startTime,endTime:t.endTime}),t.startTime=e(c[r].startTime+s,0,a.duration),t.endTime=e(c[r].endTime+s,0,a.duration)})),n.show="".concat(i.get("Subtitle offset time"),": ").concat(r,"s"),t.emit("subtitleOffset",r)}else n.show="".concat(i.get("No subtitles found")),t.emit("subtitleOffset",0)}}}function We(t){var e=t.events.proxy,r=t.template,n=t.player,o=t.option,i=t.setting,a=t.i18n;function c(e){if(e){var i=r.$video.canPlayType(e.type);if("maybe"===i||"probably"===i){var a=URL.createObjectURL(e);o.title=e.name,n.switchUrl(a,e.name),t.emit("localVideo",e)}else L(!1,"Playback of this file format is not supported")}}function l(t){var r=x(t,'');O(t,"position","relative"),k(r,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(r,"change",(function(){c(r.files[0])}))}return e(r.$player,"dragover",(function(t){t.preventDefault()})),e(r.$player,"drop",(function(t){t.preventDefault(),c(t.dataTransfer.files[0])})),t.once("ready",(function(){i.add({title:"Local Video",name:"localVideo",index:30,html:'
'.concat(a.get("Local Video"),'
').concat(a.get("Open"),'
'),mounted:function(e){var r=v(".art-upload-btn",e),n=v(".art-upload-value",e);t.on("localVideo",(function(t){n.textContent=t.name,n.title=t.name})),l(r)}})})),{name:"localVideo",attach:l}}function He(t){var e=t.events.proxy,r=t.subtitle,n=t.setting,o=t.i18n;function i(n){var o=x(n,'');O(n,"position","relative"),k(o,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(o,"change",(function(){!function(e){if(e){var n=B(e.name);["ass","vtt","srt"].includes(n)?(r.switch(URL.createObjectURL(e),{name:e.name,ext:n}),t.emit("localSubtitle",e)):L(!1,"Only supports subtitle files in .ass, .vtt and .srt format")}}(o.files[0])}))}return t.once("ready",(function(){n.add({title:"Local Subtitle",name:"localSubtitle",index:40,html:'
'.concat(o.get("Local Subtitle"),'
').concat(o.get("Open"),'
'),mounted:function(e){var r=v(".art-upload-btn",e),n=v(".art-upload-value",e);t.on("localSubtitle",(function(t){n.textContent=t.name,n.title=t.name})),i(r)}})})),{name:"localSubtitle",attach:i}}function Ne(t){var e=t.layers,r=t.player,n=t.option.theme;return e.add({name:"miniProgressBar",style:{display:"none",position:"absolute",left:0,right:0,bottom:0,height:"2px",background:n},mounted:function(e){t.on("control",(function(t){e.style.display=t?"none":"block"})),t.on("destroy",(function(){e.style.display="none"})),t.on("video:timeupdate",(function(){e.style.width="".concat(100*r.played,"%")}))}}),{name:"miniProgressBar"}}var Ue=function(){function e(r){var n=this;t(this,e),this.art=r,this.id=0;var o=r.option;o.subtitle.url&&o.subtitleOffset&&this.add(Ve),!o.isLive&&o.miniProgressBar&&this.add(Ne),o.localVideo&&this.add(We),o.localSubtitle&&this.add(He),r.option.plugins.forEach((function(t){n.add(t)}))}return r(e,[{key:"add",value:function(t){this.id+=1;var e=t.call(this,this.art),r=e&&e.name||t.name||"plugin".concat(this.id);return L(!U(this,r),"Cannot add a plugin that already has the same name: ".concat(r)),H(this,r,{value:e}),this}}]),e}(),_e=function e(r){t(this,e);var n=r.option,o=r.events.proxy,i=r.template.$video;pt.events.forEach((function(t){o(i,t,(function(t){r.emit("video:".concat(t.type),t)}))})),Object.keys(n.moreVideoAttr).forEach((function(t){i[t]=n.moreVideoAttr[t]})),n.muted&&(i.muted=n.muted),n.volume&&(i.volume=Z(n.volume,0,1)),n.poster&&(i.poster=n.poster),n.autoplay&&(i.autoplay=n.autoplay),i.controls=!0;var a=n.type||B(n.url),c=n.customType[a];a&&c?(c(i,n.url,r),r.emit("customType",a)):(i.src=n.url,r.emit("url",i.src))};function Xe(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l(t);if(e){var o=l(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var Qe=0,Ye=[],Ze=function(e){i(a,e);var o=Xe(a);function a(e){var r;return t(this,a),(r=o.call(this)).option=u(X(a.option,e),ut),r.isFocus=!1,r.isDestroy=!1,r.userAgent=f,r.isMobile=d,r.isWechat=y,r.whitelist=new ft(n(r)),r.template=new dt(n(r)),r.events=new me(n(r)),r.whitelist.state?(r.storage=new Be(n(r)),r.icons=new Re(n(r)),r.i18n=new vt(n(r)),r.notice=new je(n(r)),r.player=new xt(n(r)),r.layers=new xe(n(r)),r.controls=new ee(n(r)),r.contextmenu=new de(n(r)),r.subtitle=new ge(n(r)),r.info=new ye(n(r)),r.loading=new ke(n(r)),r.hotkey=new be(n(r)),r.mask=new Se(n(r)),r.setting=new qe(n(r)),r.plugins=new Ue(n(r))):r.mobile=new _e(n(r)),Qe+=1,r.id=Qe,Ye.push(n(r)),r}return r(a,[{key:"destroy",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.events.destroy(),this.template.destroy(t),Ye.splice(Ye.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}],[{key:"instances",get:function(){return Ye}},{key:"version",get:function(){return"4.0.0"}},{key:"env",get:function(){return'"production"'}},{key:"config",get:function(){return pt}},{key:"utils",get:function(){return K}},{key:"scheme",get:function(){return ut}},{key:"Emitter",get:function(){return p}},{key:"validator",get:function(){return u}},{key:"kindOf",get:function(){return u.kindOf}},{key:"html",get:function(){return dt.html}},{key:"option",get:function(){return{container:"#artplayer",url:"",poster:"",title:"",type:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,autoMini:!1,loop:!1,flip:!1,rotate:!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,localVideo:!1,localSubtitle:!1,networkMonitor:!1,useSSR:!1,layers:[],contextmenu:[],controls:[],quality:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,width:160,height:90,column:10},subtitle:{url:"",style:{},encoding:"utf-8",bilingual:!1},moreVideoAttr:{controls:!1,preload:h?"auto":"metadata"},icons:{},customType:{},lang:navigator.language.toLowerCase()}}}]),a}(p);return console.log("%c ArtPlayer %c 4.0.0 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),Ze})); diff --git a/scripts/getProjects.js b/scripts/getProjects.js index 6d581a462..a8b4d52ae 100644 --- a/scripts/getProjects.js +++ b/scripts/getProjects.js @@ -2,9 +2,14 @@ const path = require('path'); const glob = require('glob'); module.exports = function getProjects() { - return glob.sync(path.join(process.cwd(), 'packages/*')).reduce((result, item) => { - const name = item.split(path.sep).pop(); - result[name] = item; - return result; - }, {}); + return glob + .sync(path.join(process.cwd(), 'packages/*')) + .filter((item) => { + return !item.includes('artplayer-document'); + }) + .reduce((result, item) => { + const name = item.split(path.sep).pop(); + result[name] = item; + return result; + }, {}); };