From 787f5a8f6eb7593458dcfa04ac091f05c745b9d4 Mon Sep 17 00:00:00 2001 From: Harvey Date: Mon, 10 Jan 2022 09:54:28 +0800 Subject: [PATCH] 4.2.3 --- dist/artplayer.js | 4 ++-- packages/artplayer/dist/artplayer.js | 4 ++-- packages/artplayer/package.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/artplayer.js b/dist/artplayer.js index a08ecac0e..0624ec03f 100644 --- a/dist/artplayer.js +++ b/dist/artplayer.js @@ -1,8 +1,8 @@ /*! - * artplayer.js v4.2.2 + * artplayer.js v4.2.3 * Github: https://github.com/zhw2590582/ArtPlayer#readme * (c) 2017-2022 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).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 m(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(e.querySelectorAll(t))}function b(t,e){return t.classList.add(e)}function w(t,e){return t.classList.remove(e)}function x(t,e){return t.classList.contains(e)}function O(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}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 R(t,e){S(t).forEach((function(t){return w(t,e)})),b(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 $(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 D(t,e){return t.composedPath&&t.composedPath().indexOf(e)>-1}function z(t,e){return e.parentNode.replaceChild(t,e),t}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 C(t,e,r){return C=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},C.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 C(t,arguments,s(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),o(n,t)},A(t)}function L(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=s(t);if(e){var o=s(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var M=function(e){i(o,e);var r=L(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 q(t,e){if(!t)throw new M(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 B(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function I(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 V(t){return t.includes("?")?V(t.split("?")[0]):t.includes("#")?V(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 H(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(e){return setTimeout(e,t)}))}function J(t,e){var r,n,o=!1;return function i(){for(var a=arguments.length,c=new Array(a),s=0;s0?[e,r,n]:[r,n]).map((function(t){return t<10?"0".concat(t):String(t)})).join(":")}function tt(t){return t.replace(/[&<>'"]/g,(function(t){return{"&":"&","<":"<",">":">","'":"'",'"':"""}[t]||t}))}var et=Object.freeze({__proto__:null,query:g,queryAll:m,addClass:b,removeClass:w,hasClass:x,append:O,remove:function(t){return t.parentNode.removeChild(t)},setStyle:k,setStyles:j,getStyle:P,sublings:S,inverseClass:R,tooltip:E,isInViewport:$,includeFromEvent:D,replaceElement:z,ArtPlayerError:M,errorHandle:q,srtToVtt:F,vttToBlob:B,assToVtt:I,getExt:V,download:W,def:U,has:X,get:Q,mergeDeep:Y,sleep:Z,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(f);case"regexp":return t.test(f);default:return!1}}))}}]),e}(),vt=function(){function e(r){var n=this;t(this,e),this.art=r;var o=r.option,i=r.constructor,a=r.whitelist;o.container instanceof Element?this.$container=o.container:(this.$container=g(o.container),q(this.$container,"No container element found by ".concat(o.container)));var c=this.$container.tagName.toLowerCase();q("div"===c,"Unsupported container element type, only support 'div' but got '".concat(c,"'")),q(i.instances.every((function(t){return t.template.$container!==n.$container})),"Cannot mount multiple instances on the same dom element"),this.query=this.query.bind(this),this.$container.dataset.artId=r.id,this.$original=this.$container.cloneNode(!0),a.state?this.desktop():this.mobile()}return r(e,[{key:"query",value:function(t){return g(t,this.$container)}},{key:"desktop",value:function(){var t=this.art.option;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"),t.backdrop&&(b(this.$settingInner,"art-backdrop-filter"),b(this.$contextmenu,"art-backdrop-filter"),b(this.$info,"art-backdrop-filter")),d&&b(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?z(this.$original,this.$container):b(this.$player,"art-destroy")}}],[{key:"html",get:function(){return'
Player version:
4.2.2
Video url:
Video volume:
Video time:
Video duration:
Video resolution:
x
[x]
xD7
'}}]),e}(),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":"未发现字幕"},gt={"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":"未發現字幕"},mt=function(){function e(r){t(this,e),this.art=r,this.languages={"zh-cn":yt,"zh-tw":gt},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=Y(this.languages,t),this.init()}}]),e}();var bt={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*l/s;k(r,"width","".concat(100*h,"%")),k(r,"height","100%"),k(r,"padding","0 ".concat((u-u*h)/2,"px"))}else{var v=s/d/l;k(r,"width","100%"),k(r,"height","".concat(100*v,"%")),k(r,"padding","".concat((p-p*v)/2,"px 0"))}n.dataset.aspectRatio=e}i.show="".concat(o.get("Aspect ratio"),": ").concat("default"===e?o.get("Default"):e),t.emit("aspectRatio",e)}}),U(t,"aspectRatioReset",{set:function(e){if(e&&t.aspectRatio){var r=t.aspectRatio;t.aspectRatio=r}}})}(r),function(t){var e=t.option,r=t.notice,n=t.template.$video,o=document.createElement("canvas");U(t,"getDataURL",{value:function(){return new Promise((function(t,e){try{o.width=n.videoWidth,o.height=n.videoHeight,o.getContext("2d").drawImage(n,0,0),t(o.toDataURL("image/png"))}catch(t){r.show=t,e(t)}}))}}),U(t,"getBlobUrl",{value:function(){return new Promise((function(t,e){try{o.width=n.videoWidth,o.height=n.videoHeight,o.getContext("2d").drawImage(n,0,0),o.toBlob((function(e){t(URL.createObjectURL(e))}))}catch(t){r.show=t,e(t)}}))}}),U(t,"screenshot",{value:function(){return t.getDataURL().then((function(r){return W(r,"".concat(e.title||"artplayer","_").concat(K(n.currentTime),".png")),t.emit("screenshot",r),r}))}})}(r),xt(r),function(t){var e=t.template.$player;U(t,"fullscreenWeb",{get:function(){return x(e,"art-fullscreen-web")},set:function(r){r?(b(e,"art-fullscreen-web"),t.aspectRatioReset=!0,t.autoSize=!1,t.emit("resize"),t.emit("fullscreenWeb",!0)):(w(e,"art-fullscreen-web"),t.aspectRatioReset=!0,t.autoSize=t.option.autoSize,t.emit("resize"),t.emit("fullscreenWeb"))}})}(r),Ot(r),function(t){var e=t.template.$video;U(t,"loaded",{get:function(){return t.loadedTime/e.duration}}),U(t,"loadedTime",{get:function(){return e.buffered.length?e.buffered.end(e.buffered.length-1):0}})}(r),function(t){U(t,"played",{get:function(){return t.currentTime/t.duration}})}(r),function(t){var e=t.template.$video;U(t,"playing",{get:function(){return!!(e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>2)}})}(r),function(t){var e=t.template,r=e.$container,n=e.$player,o=e.$video;U(t,"autoSize",{get:function(){return x(r,"art-auto-size")},set:function(e){if(e){var i=o.videoWidth,a=o.videoHeight,c=r.getBoundingClientRect(),s=c.width,l=c.height,u=i/a,p=s/l;if(b(r,"art-auto-size"),p>u)k(n,"width","".concat(l*u/s*100,"%")),k(n,"height","100%");else{var f=s/u/l*100;k(n,"width","100%"),k(n,"height","".concat(f,"%"))}t.emit("autoSize",{width:t.width,height:t.height})}else w(r,"art-auto-size"),k(n,"width",null),k(n,"height",null),t.emit("autoSize")}})}(r),function(t){U(t,"rect",{get:function(){return t.template.$player.getBoundingClientRect()}});for(var e=["bottom","height","left","right","top","width"],r=function(r){var n=e[r];U(t,n,{get:function(){return t.rect[n]}})},n=0;n=1?(e=[n,o],t.emit("loop",e)):(e=[],t.emit("loop"))}else e=[],t.emit("loop")}}),t.on("video:timeupdate",(function(){e.length&&(t.currentTimee[1])&&(t.seek=e[0])}))}(r),function(t){var e=t.template,r=e.$video,n=e.$player,o=t.i18n,i=t.notice;U(t,"rotate",{get:function(){return Number(n.dataset.rotate)||0},set:function(e){e||(e=0);var a=[-270,-180,-90,0,90,180,270];if(q(a.includes(e),"'rotate' only accept ".concat(a.toString()," as parameters")),0===e)delete n.dataset.rotate,k(r,"transform",null);else{t.flip=!1,t.autoSize=!0,n.dataset.rotate=e;var c=function(){var t=r.videoWidth,e=r.videoHeight;return t>e?e/t:t/e},s=0,l=1;switch(e){case-270:s=90,l=c();break;case-180:s=180;break;case-90:s=270,l=c();break;case 90:s=90,l=c();break;case 180:s=180;break;case 270:s=270,l=c()}k(r,"transform","rotate(".concat(s,"deg) scale(").concat(l,")"))}i.show="".concat(o.get("Rotate"),": ").concat(e,"°"),t.emit("rotate",e)}}),U(t,"rotateReset",{set:function(e){if(e&&t.rotate){var r=t.rotate;t.rotate=r}}})}(r),function(t){var e=t.option,r=t.template.$poster;U(t,"poster",{get:function(){return e.poster},set:function(t){e.poster=t,k(r,"backgroundImage","url(".concat(t,")"))}})}(r),function(t){var e=t.option,r=t.template,n=r.$container,o=r.$video,i=n.style.height;U(t,"autoHeight",{get:function(){return x(n,"art-auto-height")},set:function(r){if(r){var a=n.clientWidth,c=o.videoHeight*(a/o.videoWidth);k(n,"height",c+"px"),b(n,"art-auto-height"),t.autoSize=e.autoSize,t.emit("autoHeight",c)}else k(n,"height",i),w(n,"art-auto-height"),t.autoSize=e.autoSize,t.emit("autoHeight")}})}(r),function(t){var e=t.option,r=t.template.$player;U(t,"theme",{get:function(){return getComputedStyle(r).getPropertyValue("--theme")},set:function(t){e.theme=t,r.style.setProperty("--theme",t)}})}(r),function(t){U(t,"title",{get:function(){return t.option.title},set:function(e){t.option.title=e}})}(r),function(t){var e=["mini","pip","fullscreen","fullscreenWeb"];!function(e){for(var r=function(r){var n=e[r];t.on(n,(function(){t[n]&&e.filter((function(t){return t!==n})).forEach((function(e){t[e]&&(t[e]=!1)}))}))},n=0;n=Number(o.dataset.index)}));return a?a.insertAdjacentElement("beforebegin",o):O(this.$parent,o),r.html&&O(o,r.html),r.style&&j(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&&b(o,"art-control-onlyText"),U(this,n,{value:o}),o}}},{key:"selector",value:function(t,e){var r=this,n=this.art.events,o=n.hover,i=n.proxy;b(e,"art-control-selector");var a=document.createElement("div");b(a,"art-selector-value"),O(a,t.html),e.innerText="",O(e,a);var c=t.selector.map((function(t,e){return'
').concat(t.html,"
")})).join(""),s=document.createElement("div");b(s,"art-selector-list"),O(s,c),O(e,s);var l=function(){var t=P(e,"width")/2-P(s,"width")/2;s.style.left="".concat(t,"px")};o(e,l),i(s,"click",(function(e){var n=(e.composedPath()||[]).find((function(t){return x(t,"art-selector-item")}));if(n){R(n,"art-current");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)}l(),r.art.emit("selector",i,n)}}))}}]),e}();function Rt(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 i=!1,a=g(".art-progress-loaded",t),c=g(".art-progress-played",t),s=g(".art-progress-highlight",t),l=g(".art-progress-indicator",t),u=g(".art-progress-tip",t);k(c,"backgroundColor","var(--theme)");var p=14;function f(t,e){"loaded"===t&&k(a,"width","".concat(100*e,"%")),"played"===t&&(k(c,"width","".concat(100*e,"%")),k(l,"left","calc(".concat(100*e,"% - ").concat(p/2,"px)")))}r.indicator?(p=16,O(l,r.indicator)):j(l,{backgroundColor:"var(--theme)"}),j(l,{left:"-".concat(p/2,"px"),width:"".concat(p,"px"),height:"".concat(p,"px")});for(var d=0;d'))}f("loaded",e.loaded),e.on("video:progress",(function(){f("loaded",e.loaded)})),e.on("video:timeupdate",(function(){f("played",e.played)})),e.on("video:ended",(function(){f("played",1)})),o(t,"mousemove",(function(r){k(u,"display","block"),D(r,s)?function(r){var n=qt(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=qt(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)})),o(t,"mouseout",(function(){k(u,"display","none")})),o(t,"click",(function(t){if(t.target!==l){var r=qt(e,t),n=r.second;f("played",r.percentage),e.seek=n}})),o(l,"mousedown",(function(){i=!0})),o(document,"mousemove",(function(t){if(i){var r=qt(e,t),n=r.second;f("played",r.percentage),e.seek=n}})),o(document,"mouseup",(function(){i&&(i=!1)}))}})}}function Bt(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 It(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 Zt(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 Jt(t){for(var e=1;e=3e3&&(r.show=!1,b(a,"art-hide-cursor"),w(a,"art-hover"))})),e.once("ready",(function(){r.add(Ft({name:"progress",disable:i.isLive,position:"top",index:10})),r.add(Yt({name:"thumbnails",disable:!i.thumbnails.url||i.isLive,position:"top",index:20})),r.add(function(t){return function(e){return ee(ee({},t),{},{mounted:function(t){var r=O(t,''),n=O(t,'');e.on("loop",(function(o){o?(k(t,"display","block"),k(r,"left","calc(".concat(o[0]/e.duration*100,"% - ").concat(r.clientWidth,"px)")),k(n,"left","".concat(o[1]/e.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=O(t,n.play),a=O(t,n.pause);function c(){k(i,"display","flex"),k(a,"display","none")}function s(){k(i,"display","none"),k(a,"display","flex")}E(i,o.get("Play")),E(a,o.get("Pause")),r(i,"click",(function(){e.play()})),r(a,"click",(function(){e.pause()})),e.playing?s():c(),e.on("video:playing",(function(){s()})),e.on("video:pause",(function(){c()}))}})}}({name:"playAndPause",disable:!1,position:"left",index:10})),r.add(function(t){return function(e){return Nt(Nt({},t),{},{mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.i18n,i=!1,a=O(t,n.volume),c=O(t,n.volumeClose),s=O(t,'
'),l=O(s,'
');function u(t){var e=s.getBoundingClientRect().left;return G(t.pageX-e-6,0,54)/48}function p(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.7;if(e.muted||0===t)k(a,"display","none"),k(c,"display","flex"),k(l,"left","0");else{var r=48*t;k(a,"display","flex"),k(c,"display","none"),k(l,"left","".concat(r,"px"))}}E(a,o.get("Mute")),k(c,"display","none"),d&&k(s,"display","none"),p(e.volume),e.on("video:volumechange",(function(){p(e.volume)})),r(a,"click",(function(){e.muted=!0})),r(c,"click",(function(){e.muted=!1})),r(s,"click",(function(t){e.muted=!1,e.volume=u(t)})),r(l,"mousedown",(function(){i=!0})),r(t,"mousemove",(function(t){i&&(e.muted=!1,e.volume=u(t))})),r(document,"mouseup",(function(){i&&(i=!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(K(e.currentTime)," / ").concat(K(e.duration));r!==t.innerText&&(t.innerText=r)}r();for(var n=["video:loadedmetadata","video:timeupdate","video:progress"],o=0;o0.50.75').concat(r.get("Normal"),'1.251.52.0'),click:function(t,r){var n=r.target.dataset.rate;n&&(e.playbackRate=Number(n),t.show=!1)},mounted:function(t){e.on("playbackRate",(function(e){var r=m("span",t).find((function(t){return Number(t.dataset.rate)===e}));r&&R(r,"art-current")}))}})}}({disable:!i.playbackRate,name:"playbackRate",index:10})),o.add(function(t){return function(e){var r=e.i18n;return ce(ce({},t),{},{html:"".concat(r.get("Aspect ratio"),':').concat(r.get("Default"),'4:316:9'),click:function(t,r){var n=r.target.dataset.ratio;n&&(e.aspectRatio=n,t.show=!1)},mounted:function(t){e.on("aspectRatio",(function(e){var r=m("span",t).find((function(t){return t.dataset.ratio===e}));r&&R(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 pe(pe({},t),{},{html:'ArtPlayer 4.2.2'})}({disable:!1,name:"version",index:40})),o.add(function(t){return function(e){return de(de({},t),{},{html:e.i18n.get("Close"),click:function(t){t.show=!1}})}}({disable:!1,name:"close",index:60}));for(var t=0;tl+a&&(h=a-d),r+f>u+i&&(v=i-f),j(s,{top:"".concat(v,"px"),left:"".concat(h,"px")})})),l(c,"click",(function(t){D(t,s)||(o.show=!1)})),e.on("blur",(function(){o.show=!1}))})),o}return n}(St);function ye(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=s(t);if(e){var o=s(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=ye(o);function o(e){var r;return t(this,o),(r=n.call(this,e)).name="info",e.once("ready",(function(){r.init()})),r}return r(o,[{key:"init",value:function(){var t=this,e=this.art,r=e.events.proxy,n=e.template,o=n.$infoPanel,i=n.$infoClose,a=n.$video;r(i,"click",(function(){t.show=!1}));var c=null,s=m("[data-video]",o)||[];this.art.on("destroy",(function(){clearTimeout(c)})),function t(){for(var e=0;e".concat(tt(t),"

")})).join(""),this.art.emit("subtitleUpdate",this.activeCue.text))}},{key:"switch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.art,n=r.i18n,o=r.notice,i=r.option,a=be(be(be({},i.subtitle),e),{},{url:t});return this.init(a).then((function(t){return e.name&&(o.show="".concat(n.get("Switch subtitle"),": ").concat(e.name)),t}))}},{key:"init",value:function(t){var e=this;if(u(t,ft.subtitle),t.url){var r=this.art,n=r.notice,o=r.events.proxy,i=r.template,a=i.$subtitle,c=i.$video;if(!i.$track){var s=document.createElement("track");s.default=!0,s.kind="metadata",c.appendChild(s),this.art.template.$track=s,o(this.textTrack,"cuechange",this.update.bind(this))}return this.style(t.style),this.bilingual=t.bilingual,q(window.fetch,"fetch not support"),fetch(t.url).then((function(t){return t.arrayBuffer()})).then((function(r){q(window.TextDecoder,"TextDecoder not support");var n=new TextDecoder(t.encoding).decode(r);switch(e.art.emit("subtitleLoad",t.url),t.type||V(t.url)){case"srt":return B(F(n));case"ass":return B(I(n));case"vtt":return B(n);default:return t.url}})).then((function(t){return a.innerHTML="",e.url===t||(URL.revokeObjectURL(e.url),e.art.template.$track.src=t,e.art.emit("subtitleSwitch",t)),t})).catch((function(t){throw n.show=t,t}))}}}]),o}(St);var Oe=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){D(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(){b(r,"art-hover"),t.emit("hover",!0)}),(function(){w(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=J((function(){t.normalSize&&(t.autoSize=r.autoSize),t.aspectRatioReset=!0,t.emit("resize")}),500);e.proxy(window,["orientationchange","resize"],(function(){n()})),screen&&screen.orientation&&screen.orientation.onchange&&e.proxy(screen.orientation,"change",(function(){n()}))}(r,n),function(t,e){if(d&&!t.option.isLive){var r=t.notice,n=t.template.$video,o=!1,i=0,a=0;e.proxy(n,"touchstart",(function(t){1===t.touches.length&&(o=!0,i=t.touches[0].clientX)})),e.proxy(document,"touchmove",(function(e){if(1===e.touches.length&&o){var c=G((e.touches[0].clientX-i)/n.clientWidth,-1,1);a=G(t.currentTime+60*c,0,t.duration),r.show="".concat(K(a)," / ").concat(K(t.duration))}})),e.proxy(document,"touchend",(function(){o&&a&&(t.seek=a),o=!1,i=0,a=0}))}}(r,n),function(t,e){var r=t.option,n=t.template.$container,o=J((function(){t.emit("view",$(n,50))}),200);e.proxy(window,"scroll",(function(){o()})),t.on("view",(function(e){r.autoMini&&(t.mini=!e)}))}(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 M("Unable to get Image"));(o=new Image).src=t}if(o.complete)return r(o);e.proxy(o,"load",(function(){return r(o)})),e.proxy(o,"error",(function(){return n(new M("Failed to load Image: ".concat(o.src)))}))}))}},{key:"destroy",value:function(){for(var t=0;t',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){U(n,t,{get:function(){var e=document.createElement("i");return b(e,"art-icon"),b(e,"art-icon-".concat(t)),O(e,o[t]),e}})}))};function Ce(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,r){var n=r.target.dataset.value;n&&(e.flip=n)},mounted:function(t){e.on("flip",(function(e){var r=m("button",t).find((function(t){return t.dataset.value===e}));r&&R(r.parentElement,"current")}))}})}}({disable:!i.flip,name:"flip"})),o.add(function(t){return function(e){var r=e.i18n;return Me(Me({},t),{},{html:'
'.concat(r.get("Rotate"),': 0°
'),click:function(t,r){var n=r.target.dataset.value;if(n){var o=e.rotate+Number(n);e.rotate=360===o||-360===o?0:o}else e.rotate=0},mounted:function(t){var r=g(".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;return Fe(Fe({},t),{},{html:'
'.concat(r.get("Aspect ratio"),'
'),click:function(t,r){var n=r.target.dataset.value;n&&(e.aspectRatio=n)},mounted:function(t){e.on("aspectRatio",(function(e){var r=m("button",t).find((function(t){return t.dataset.value===e}));r&&R(r.parentElement,"current")}))}})}}({disable:!i.aspectRatio,name:"aspectRatio"})),o.add(function(t){return function(e){var r=e.i18n,n=e.events.proxy;return Ie(Ie({},t),{},{html:'
'.concat(r.get("Play speed"),': 1.0x
'),mounted:function(t){var r=g(".art-setting-range input",t),o=g(".art-subtitle-value",t);n(r,"change",(function(){var t=r.value;o.innerText=t,e.playbackRate=Number(t)})),e.on("playbackRate",(function(t){t&&r.value!==t&&(r.value=t,o.innerText=t)}))}})}}({disable:!i.playbackRate,name:"playbackRate"}));for(var t=0;t'.concat(e.get("Subtitle offset time"),': 0s
'),mounted:function(e){var o=g(".art-setting-range input",e),i=g(".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 Ue(t){var e=t.constructor.utils.clamp,r=t.setting,n=t.notice,o=t.template,i=t.i18n;r.add(Ne);var a=[];return t.on("subtitle:switch",(function(){a=[]})),{name:"subtitleOffset",offset:function(r){if(o.$track&&o.$track.track){for(var c=Array.from(o.$track.track.cues),s=e(r,-5,5),l=0;l');k(t,"position","relative"),j(r,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(r,"change",(function(){s(r.files[0])}))}return e(o,"dragover",(function(t){t.preventDefault()})),e(o,"drop",(function(t){t.preventDefault(),s(t.dataTransfer.files[0])})),t.once("ready",(function(){a.add({title:"Local Video",name:"localVideo",index:30,html:'
'.concat(c.get("Local Video"),'
').concat(c.get("Open"),'
'),mounted:function(e){var r=g(".art-upload-btn",e),n=g(".art-upload-value",e);t.on("localVideo",(function(t){n.textContent=t.name,n.title=t.name})),l(r)}})})),{name:"localVideo",attach:l}}function Xe(t){var e=t.events.proxy,r=t.subtitle,n=t.setting,o=t.i18n;function i(n){var o=O(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=V(e.name);["ass","vtt","srt"].includes(n)?(r.switch(URL.createObjectURL(e),{name:e.name,ext:n}),t.emit("localSubtitle",e)):q(!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=g(".art-upload-btn",e),n=g(".art-upload-value",e);t.on("localSubtitle",(function(t){n.textContent=t.name,n.title=t.name})),i(r)}})})),{name:"localSubtitle",attach:i}}function Qe(t){return t.layers.add({name:"miniProgressBar",style:{display:"none",position:"absolute",left:0,right:0,bottom:0,height:"2px",backgroundColor:"var(--theme)"},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*t.played,"%")}))}}),{name:"miniProgressBar"}}var Ye=function(){function e(r){t(this,e),this.art=r,this.id=0;var n=r.option;n.subtitle.url&&n.subtitleOffset&&this.add(Ue),!n.isLive&&n.miniProgressBar&&this.add(Qe),n.localVideo&&this.add(_e),n.localSubtitle&&this.add(Xe);for(var o=0;o0&&void 0!==arguments[0]?arguments[0]:{};this.isEnd||(this.art.switchUrl(e.url),this.art.once("video:timeupdate",(function(){t.art.emit("ads:start",e)})),this.art.once("video:ended",(function(){var e=t.next;e?(t.index+=1,t.play(e)):t.end()})))}},{key:"end",value:function(){this.isEnd||(this.isEnd=!0,this.playing=!1,this.art.option.url=this.urlCache,this.art.switchUrl(this.urlCache),this.art.emit("ads:end"))}}]),e}(),Je=function e(r){t(this,e);for(var n=r.option,o=r.events.proxy,i=r.template.$video,a=0;a0&&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"4.2.2"}},{key:"env",get:function(){return"production"}},{key:"build",get:function(){return"1641598133160"}},{key:"config",get:function(){return dt}},{key:"utils",get:function(){return et}},{key:"scheme",get:function(){return ft}},{key:"Emitter",get:function(){return p}},{key:"validator",get:function(){return u}},{key:"kindOf",get:function(){return u.kindOf}},{key:"html",get:function(){return vt.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,useSSR:!1,ads:[],layers:[],contextmenu:[],controls:[],settings:[],quality:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,width:160,height:90,column:10},subtitle:{url:"",type:"",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.2.2 %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 m(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(e.querySelectorAll(t))}function b(t,e){return t.classList.add(e)}function w(t,e){return t.classList.remove(e)}function x(t,e){return t.classList.contains(e)}function O(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}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 R(t,e){S(t).forEach((function(t){return w(t,e)})),b(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 $(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 D(t,e){return t.composedPath&&t.composedPath().indexOf(e)>-1}function z(t,e){return e.parentNode.replaceChild(t,e),t}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 C(t,e,r){return C=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},C.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 C(t,arguments,s(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),o(n,t)},A(t)}function L(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=s(t);if(e){var o=s(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var M=function(e){i(o,e);var r=L(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 q(t,e){if(!t)throw new M(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 B(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function I(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 V(t){return t.includes("?")?V(t.split("?")[0]):t.includes("#")?V(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 N(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(e){return setTimeout(e,t)}))}function J(t,e){var r,n,o=!1;return function i(){for(var a=arguments.length,c=new Array(a),s=0;s0?[e,r,n]:[r,n]).map((function(t){return t<10?"0".concat(t):String(t)})).join(":")}function tt(t){return t.replace(/[&<>'"]/g,(function(t){return{"&":"&","<":"<",">":">","'":"'",'"':"""}[t]||t}))}var et=Object.freeze({__proto__:null,query:g,queryAll:m,addClass:b,removeClass:w,hasClass:x,append:O,remove:function(t){return t.parentNode.removeChild(t)},setStyle:k,setStyles:j,getStyle:P,sublings:S,inverseClass:R,tooltip:E,isInViewport:$,includeFromEvent:D,replaceElement:z,ArtPlayerError:M,errorHandle:q,srtToVtt:F,vttToBlob:B,assToVtt:I,getExt:V,download:W,def:U,has:X,get:Q,mergeDeep:Y,sleep:Z,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(f);case"regexp":return t.test(f);default:return!1}}))}}]),e}(),vt=function(){function e(r){var n=this;t(this,e),this.art=r;var o=r.option,i=r.constructor,a=r.whitelist;o.container instanceof Element?this.$container=o.container:(this.$container=g(o.container),q(this.$container,"No container element found by ".concat(o.container)));var c=this.$container.tagName.toLowerCase();q("div"===c,"Unsupported container element type, only support 'div' but got '".concat(c,"'")),q(i.instances.every((function(t){return t.template.$container!==n.$container})),"Cannot mount multiple instances on the same dom element"),this.query=this.query.bind(this),this.$container.dataset.artId=r.id,this.$original=this.$container.cloneNode(!0),a.state?this.desktop():this.mobile()}return r(e,[{key:"query",value:function(t){return g(t,this.$container)}},{key:"desktop",value:function(){var t=this.art.option;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"),t.backdrop&&(b(this.$settingInner,"art-backdrop-filter"),b(this.$contextmenu,"art-backdrop-filter"),b(this.$info,"art-backdrop-filter")),d&&b(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?z(this.$original,this.$container):b(this.$player,"art-destroy")}}],[{key:"html",get:function(){return'
Player version:
4.2.3
Video url:
Video volume:
Video time:
Video duration:
Video resolution:
x
[x]
xD7
'}}]),e}(),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":"未发现字幕"},gt={"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":"未發現字幕"},mt=function(){function e(r){t(this,e),this.art=r,this.languages={"zh-cn":yt,"zh-tw":gt},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=Y(this.languages,t),this.init()}}]),e}();var bt={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*l/s;k(r,"width","".concat(100*h,"%")),k(r,"height","100%"),k(r,"padding","0 ".concat((u-u*h)/2,"px"))}else{var v=s/d/l;k(r,"width","100%"),k(r,"height","".concat(100*v,"%")),k(r,"padding","".concat((p-p*v)/2,"px 0"))}n.dataset.aspectRatio=e}i.show="".concat(o.get("Aspect ratio"),": ").concat("default"===e?o.get("Default"):e),t.emit("aspectRatio",e)}}),U(t,"aspectRatioReset",{set:function(e){if(e&&t.aspectRatio){var r=t.aspectRatio;t.aspectRatio=r}}})}(r),function(t){var e=t.option,r=t.notice,n=t.template.$video,o=document.createElement("canvas");U(t,"getDataURL",{value:function(){return new Promise((function(t,e){try{o.width=n.videoWidth,o.height=n.videoHeight,o.getContext("2d").drawImage(n,0,0),t(o.toDataURL("image/png"))}catch(t){r.show=t,e(t)}}))}}),U(t,"getBlobUrl",{value:function(){return new Promise((function(t,e){try{o.width=n.videoWidth,o.height=n.videoHeight,o.getContext("2d").drawImage(n,0,0),o.toBlob((function(e){t(URL.createObjectURL(e))}))}catch(t){r.show=t,e(t)}}))}}),U(t,"screenshot",{value:function(){return t.getDataURL().then((function(r){return W(r,"".concat(e.title||"artplayer","_").concat(K(n.currentTime),".png")),t.emit("screenshot",r),r}))}})}(r),xt(r),function(t){var e=t.template.$player;U(t,"fullscreenWeb",{get:function(){return x(e,"art-fullscreen-web")},set:function(r){r?(b(e,"art-fullscreen-web"),t.aspectRatioReset=!0,t.autoSize=!1,t.emit("resize"),t.emit("fullscreenWeb",!0)):(w(e,"art-fullscreen-web"),t.aspectRatioReset=!0,t.autoSize=t.option.autoSize,t.emit("resize"),t.emit("fullscreenWeb"))}})}(r),Ot(r),function(t){var e=t.template.$video;U(t,"loaded",{get:function(){return t.loadedTime/e.duration}}),U(t,"loadedTime",{get:function(){return e.buffered.length?e.buffered.end(e.buffered.length-1):0}})}(r),function(t){U(t,"played",{get:function(){return t.currentTime/t.duration}})}(r),function(t){var e=t.template.$video;U(t,"playing",{get:function(){return!!(e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>2)}})}(r),function(t){var e=t.template,r=e.$container,n=e.$player,o=e.$video;U(t,"autoSize",{get:function(){return x(r,"art-auto-size")},set:function(e){if(e){var i=o.videoWidth,a=o.videoHeight,c=r.getBoundingClientRect(),s=c.width,l=c.height,u=i/a,p=s/l;if(b(r,"art-auto-size"),p>u)k(n,"width","".concat(l*u/s*100,"%")),k(n,"height","100%");else{var f=s/u/l*100;k(n,"width","100%"),k(n,"height","".concat(f,"%"))}t.emit("autoSize",{width:t.width,height:t.height})}else w(r,"art-auto-size"),k(n,"width",null),k(n,"height",null),t.emit("autoSize")}})}(r),function(t){U(t,"rect",{get:function(){return t.template.$player.getBoundingClientRect()}});for(var e=["bottom","height","left","right","top","width"],r=function(r){var n=e[r];U(t,n,{get:function(){return t.rect[n]}})},n=0;n=1?(e=[n,o],t.emit("loop",e)):(e=[],t.emit("loop"))}else e=[],t.emit("loop")}}),t.on("video:timeupdate",(function(){e.length&&(t.currentTimee[1])&&(t.seek=e[0])}))}(r),function(t){var e=t.template,r=e.$video,n=e.$player,o=t.i18n,i=t.notice;U(t,"rotate",{get:function(){return Number(n.dataset.rotate)||0},set:function(e){e||(e=0);var a=[-270,-180,-90,0,90,180,270];if(q(a.includes(e),"'rotate' only accept ".concat(a.toString()," as parameters")),0===e)delete n.dataset.rotate,k(r,"transform",null);else{t.flip=!1,t.autoSize=!0,n.dataset.rotate=e;var c=function(){var t=r.videoWidth,e=r.videoHeight;return t>e?e/t:t/e},s=0,l=1;switch(e){case-270:s=90,l=c();break;case-180:s=180;break;case-90:s=270,l=c();break;case 90:s=90,l=c();break;case 180:s=180;break;case 270:s=270,l=c()}k(r,"transform","rotate(".concat(s,"deg) scale(").concat(l,")"))}i.show="".concat(o.get("Rotate"),": ").concat(e,"°"),t.emit("rotate",e)}}),U(t,"rotateReset",{set:function(e){if(e&&t.rotate){var r=t.rotate;t.rotate=r}}})}(r),function(t){var e=t.option,r=t.template.$poster;U(t,"poster",{get:function(){return e.poster},set:function(t){e.poster=t,k(r,"backgroundImage","url(".concat(t,")"))}})}(r),function(t){var e=t.option,r=t.template,n=r.$container,o=r.$video,i=n.style.height;U(t,"autoHeight",{get:function(){return x(n,"art-auto-height")},set:function(r){if(r){var a=n.clientWidth,c=o.videoHeight*(a/o.videoWidth);k(n,"height",c+"px"),b(n,"art-auto-height"),t.autoSize=e.autoSize,t.emit("autoHeight",c)}else k(n,"height",i),w(n,"art-auto-height"),t.autoSize=e.autoSize,t.emit("autoHeight")}})}(r),function(t){var e=t.option,r=t.template.$player;U(t,"theme",{get:function(){return getComputedStyle(r).getPropertyValue("--theme")},set:function(t){e.theme=t,r.style.setProperty("--theme",t)}})}(r),function(t){U(t,"title",{get:function(){return t.option.title},set:function(e){t.option.title=e}})}(r),function(t){var e=["mini","pip","fullscreen","fullscreenWeb"];!function(e){for(var r=function(r){var n=e[r];t.on(n,(function(){t[n]&&e.filter((function(t){return t!==n})).forEach((function(e){t[e]&&(t[e]=!1)}))}))},n=0;n=Number(o.dataset.index)}));return a?a.insertAdjacentElement("beforebegin",o):O(this.$parent,o),r.html&&O(o,r.html),r.style&&j(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&&b(o,"art-control-onlyText"),U(this,n,{value:o}),o}}},{key:"selector",value:function(t,e){var r=this,n=this.art.events,o=n.hover,i=n.proxy;b(e,"art-control-selector");var a=document.createElement("div");b(a,"art-selector-value"),O(a,t.html),e.innerText="",O(e,a);var c=t.selector.map((function(t,e){return'
').concat(t.html,"
")})).join(""),s=document.createElement("div");b(s,"art-selector-list"),O(s,c),O(e,s);var l=function(){var t=P(e,"width")/2-P(s,"width")/2;s.style.left="".concat(t,"px")};o(e,l),i(s,"click",(function(e){var n=(e.composedPath()||[]).find((function(t){return x(t,"art-selector-item")}));if(n){R(n,"art-current");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)}l(),r.art.emit("selector",i,n)}}))}}]),e}();function Rt(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 i=!1,a=g(".art-progress-loaded",t),c=g(".art-progress-played",t),s=g(".art-progress-highlight",t),l=g(".art-progress-indicator",t),u=g(".art-progress-tip",t);k(c,"backgroundColor","var(--theme)");var p=14;function f(t,e){"loaded"===t&&k(a,"width","".concat(100*e,"%")),"played"===t&&(k(c,"width","".concat(100*e,"%")),k(l,"left","calc(".concat(100*e,"% - ").concat(p/2,"px)")))}r.indicator?(p=16,O(l,r.indicator)):j(l,{backgroundColor:"var(--theme)"}),j(l,{left:"-".concat(p/2,"px"),width:"".concat(p,"px"),height:"".concat(p,"px")});for(var d=0;d'))}f("loaded",e.loaded),e.on("video:progress",(function(){f("loaded",e.loaded)})),e.on("video:timeupdate",(function(){f("played",e.played)})),e.on("video:ended",(function(){f("played",1)})),o(t,"mousemove",(function(r){k(u,"display","block"),D(r,s)?function(r){var n=qt(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=qt(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)})),o(t,"mouseout",(function(){k(u,"display","none")})),o(t,"click",(function(t){if(t.target!==l){var r=qt(e,t),n=r.second;f("played",r.percentage),e.seek=n}})),o(l,"mousedown",(function(){i=!0})),o(document,"mousemove",(function(t){if(i){var r=qt(e,t),n=r.second;f("played",r.percentage),e.seek=n}})),o(document,"mouseup",(function(){i&&(i=!1)})),o(l,"touchstart",(function(t){1===t.touches.length&&(i=!0)})),o(document,"touchmove",(function(t){if(1===t.touches.length&&i){var r=qt(e,t),n=r.second;f("played",r.percentage),e.seek=n}})),o(document,"touchend",(function(){i&&(i=!1)}))}})}}function Bt(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 It(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 Zt(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 Jt(t){for(var e=1;e=3e3&&(r.show=!1,b(a,"art-hide-cursor"),w(a,"art-hover"))})),e.once("ready",(function(){r.add(Ft({name:"progress",disable:i.isLive,position:"top",index:10})),r.add(Yt({name:"thumbnails",disable:!i.thumbnails.url||i.isLive,position:"top",index:20})),r.add(function(t){return function(e){return ee(ee({},t),{},{mounted:function(t){var r=O(t,''),n=O(t,'');e.on("loop",(function(o){o?(k(t,"display","block"),k(r,"left","calc(".concat(o[0]/e.duration*100,"% - ").concat(r.clientWidth,"px)")),k(n,"left","".concat(o[1]/e.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=O(t,n.play),a=O(t,n.pause);function c(){k(i,"display","flex"),k(a,"display","none")}function s(){k(i,"display","none"),k(a,"display","flex")}E(i,o.get("Play")),E(a,o.get("Pause")),r(i,"click",(function(){e.play()})),r(a,"click",(function(){e.pause()})),e.playing?s():c(),e.on("video:playing",(function(){s()})),e.on("video:pause",(function(){c()}))}})}}({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.i18n,i=!1,a=O(t,n.volume),c=O(t,n.volumeClose),s=O(t,'
'),l=O(s,'
');function u(t){var e=s.getBoundingClientRect().left;return G(t.pageX-e-6,0,54)/48}function p(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.7;if(e.muted||0===t)k(a,"display","none"),k(c,"display","flex"),k(l,"left","0");else{var r=48*t;k(a,"display","flex"),k(c,"display","none"),k(l,"left","".concat(r,"px"))}}E(a,o.get("Mute")),k(c,"display","none"),d&&k(s,"display","none"),p(e.volume),e.on("video:volumechange",(function(){p(e.volume)})),r(a,"click",(function(){e.muted=!0})),r(c,"click",(function(){e.muted=!1})),r(s,"click",(function(t){e.muted=!1,e.volume=u(t)})),r(l,"mousedown",(function(){i=!0})),r(t,"mousemove",(function(t){i&&(e.muted=!1,e.volume=u(t))})),r(document,"mouseup",(function(){i&&(i=!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(K(e.currentTime)," / ").concat(K(e.duration));r!==t.innerText&&(t.innerText=r)}r();for(var n=["video:loadedmetadata","video:timeupdate","video:progress"],o=0;o0.50.75').concat(r.get("Normal"),'1.251.52.0'),click:function(t,r){var n=r.target.dataset.rate;n&&(e.playbackRate=Number(n),t.show=!1)},mounted:function(t){e.on("playbackRate",(function(e){var r=m("span",t).find((function(t){return Number(t.dataset.rate)===e}));r&&R(r,"art-current")}))}})}}({disable:!r.playbackRate,name:"playbackRate",index:10})),this.add(function(t){return function(e){var r=e.i18n;return ce(ce({},t),{},{html:"".concat(r.get("Aspect ratio"),':').concat(r.get("Default"),'4:316:9'),click:function(t,r){var n=r.target.dataset.ratio;n&&(e.aspectRatio=n,t.show=!1)},mounted:function(t){e.on("aspectRatio",(function(e){var r=m("span",t).find((function(t){return t.dataset.ratio===e}));r&&R(r,"art-current")}))}})}}({disable:!r.aspectRatio,name:"aspectRatio",index:20})),this.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})),this.add(function(t){return pe(pe({},t),{},{html:'ArtPlayer 4.2.3'})}({disable:!1,name:"version",index:40})),this.add(function(t){return function(e){return de(de({},t),{},{html:e.i18n.get("Close"),click:function(t){t.show=!1}})}}({disable:!1,name:"close",index:60}));for(var c=0;cl+s&&(h=s-d),n+f>u+c&&(v=c-f),j(i,{top:"".concat(v,"px"),left:"".concat(h,"px")})})),a(o,"click",(function(e){D(e,i)||(t.show=!1)})),this.art.on("blur",(function(){t.show=!1}))}}]),o}(St);function ye(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=s(t);if(e){var o=s(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=ye(o);function o(e){var r;return t(this,o),(r=n.call(this,e)).name="info",e.once("ready",(function(){d||r.init()})),r}return r(o,[{key:"init",value:function(){var t=this,e=this.art,r=e.events.proxy,n=e.template,o=n.$infoPanel,i=n.$infoClose,a=n.$video;r(i,"click",(function(){t.show=!1}));var c=null,s=m("[data-video]",o)||[];this.art.on("destroy",(function(){clearTimeout(c)})),function t(){for(var e=0;e".concat(tt(t),"

")})).join(""),this.art.emit("subtitleUpdate",this.activeCue.text))}},{key:"switch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.art,n=r.i18n,o=r.notice,i=r.option,a=be(be(be({},i.subtitle),e),{},{url:t});return this.init(a).then((function(t){return e.name&&(o.show="".concat(n.get("Switch subtitle"),": ").concat(e.name)),t}))}},{key:"init",value:function(t){var e=this;if(u(t,ft.subtitle),t.url){var r=this.art,n=r.notice,o=r.events.proxy,i=r.template,a=i.$subtitle,c=i.$video;if(!i.$track){var s=document.createElement("track");s.default=!0,s.kind="metadata",c.appendChild(s),this.art.template.$track=s,o(this.textTrack,"cuechange",this.update.bind(this))}return this.style(t.style),this.bilingual=t.bilingual,q(window.fetch,"fetch not support"),fetch(t.url).then((function(t){return t.arrayBuffer()})).then((function(r){q(window.TextDecoder,"TextDecoder not support");var n=new TextDecoder(t.encoding).decode(r);switch(e.art.emit("subtitleLoad",t.url),t.type||V(t.url)){case"srt":return B(F(n));case"ass":return B(I(n));case"vtt":return B(n);default:return t.url}})).then((function(t){return a.innerHTML="",e.url===t||(URL.revokeObjectURL(e.url),e.art.template.$track.src=t,e.art.emit("subtitleSwitch",t)),t})).catch((function(t){throw n.show=t,t}))}}}]),o}(St);var Oe=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){D(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(){b(r,"art-hover"),t.emit("hover",!0)}),(function(){w(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=J((function(){t.normalSize&&(t.autoSize=r.autoSize),t.aspectRatioReset=!0,t.emit("resize")}),500);e.proxy(window,["orientationchange","resize"],(function(){n()})),screen&&screen.orientation&&screen.orientation.onchange&&e.proxy(screen.orientation,"change",(function(){n()}))}(r,n),function(t,e){if(d&&!t.option.isLive){var r=t.notice,n=t.template.$video,o=!1,i=0,a=0;e.proxy(n,"touchstart",(function(t){1===t.touches.length&&(o=!0,i=t.touches[0].clientX)})),e.proxy(n,"touchmove",(function(e){if(1===e.touches.length&&o){var c=G((e.touches[0].clientX-i)/n.clientWidth,-1,1);a=G(t.currentTime+60*c,0,t.duration),r.show="".concat(K(a)," / ").concat(K(t.duration))}})),e.proxy(document,"touchend",(function(){o&&a&&(t.seek=a),o=!1,i=0,a=0}))}}(r,n),function(t,e){var r=t.option,n=t.template.$container,o=J((function(){t.emit("view",$(n,50))}),200);e.proxy(window,"scroll",(function(){o()})),t.on("view",(function(e){r.autoMini&&(t.mini=!e)}))}(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 M("Unable to get Image"));(o=new Image).src=t}if(o.complete)return r(o);e.proxy(o,"load",(function(){return r(o)})),e.proxy(o,"error",(function(){return n(new M("Failed to load Image: ".concat(o.src)))}))}))}},{key:"destroy",value:function(){for(var t=0;t',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){U(n,t,{get:function(){var e=document.createElement("i");return b(e,"art-icon"),b(e,"art-icon-".concat(t)),O(e,o[t]),e}})}))};function Ce(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,r){var n=r.target.dataset.value;n&&(e.flip=n)},mounted:function(t){e.on("flip",(function(e){var r=m("button",t).find((function(t){return t.dataset.value===e}));r&&R(r.parentElement,"current")}))}})}}({disable:!i.flip,name:"flip"})),o.add(function(t){return function(e){var r=e.i18n;return Me(Me({},t),{},{html:'
'.concat(r.get("Rotate"),': 0°
'),click:function(t,r){var n=r.target.dataset.value;if(n){var o=e.rotate+Number(n);e.rotate=360===o||-360===o?0:o}else e.rotate=0},mounted:function(t){var r=g(".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;return Fe(Fe({},t),{},{html:'
'.concat(r.get("Aspect ratio"),'
'),click:function(t,r){var n=r.target.dataset.value;n&&(e.aspectRatio=n)},mounted:function(t){e.on("aspectRatio",(function(e){var r=m("button",t).find((function(t){return t.dataset.value===e}));r&&R(r.parentElement,"current")}))}})}}({disable:!i.aspectRatio,name:"aspectRatio"})),o.add(function(t){return function(e){var r=e.i18n,n=e.events.proxy;return Ie(Ie({},t),{},{html:'
'.concat(r.get("Play speed"),': 1.0x
'),mounted:function(t){var r=g(".art-setting-range input",t),o=g(".art-subtitle-value",t);n(r,"change",(function(){var t=r.value;o.innerText=t,e.playbackRate=Number(t)})),e.on("playbackRate",(function(t){t&&r.value!==t&&(r.value=t,o.innerText=t)}))}})}}({disable:!i.playbackRate,name:"playbackRate"}));for(var t=0;t'.concat(e.get("Subtitle offset time"),': 0s
'),mounted:function(e){var o=g(".art-setting-range input",e),i=g(".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 Ue(t){var e=t.constructor.utils.clamp,r=t.setting,n=t.notice,o=t.template,i=t.i18n;r.add(He);var a=[];return t.on("subtitle:switch",(function(){a=[]})),{name:"subtitleOffset",offset:function(r){if(o.$track&&o.$track.track){for(var c=Array.from(o.$track.track.cues),s=e(r,-5,5),l=0;l');k(t,"position","relative"),j(r,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(r,"change",(function(){s(r.files[0])}))}return e(o,"dragover",(function(t){t.preventDefault()})),e(o,"drop",(function(t){t.preventDefault(),s(t.dataTransfer.files[0])})),t.once("ready",(function(){a.add({title:"Local Video",name:"localVideo",index:30,html:'
'.concat(c.get("Local Video"),'
').concat(c.get("Open"),'
'),mounted:function(e){var r=g(".art-upload-btn",e),n=g(".art-upload-value",e);t.on("localVideo",(function(t){n.textContent=t.name,n.title=t.name})),l(r)}})})),{name:"localVideo",attach:l}}function Xe(t){var e=t.events.proxy,r=t.subtitle,n=t.setting,o=t.i18n;function i(n){var o=O(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=V(e.name);["ass","vtt","srt"].includes(n)?(r.switch(URL.createObjectURL(e),{name:e.name,ext:n}),t.emit("localSubtitle",e)):q(!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=g(".art-upload-btn",e),n=g(".art-upload-value",e);t.on("localSubtitle",(function(t){n.textContent=t.name,n.title=t.name})),i(r)}})})),{name:"localSubtitle",attach:i}}function Qe(t){return t.layers.add({name:"miniProgressBar",style:{display:"none",position:"absolute",left:0,right:0,bottom:0,height:"2px",backgroundColor:"var(--theme)"},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*t.played,"%")}))}}),{name:"miniProgressBar"}}var Ye=function(){function e(r){t(this,e),this.art=r,this.id=0;var n=r.option;n.subtitle.url&&n.subtitleOffset&&this.add(Ue),!n.isLive&&n.miniProgressBar&&this.add(Qe),n.localVideo&&this.add(_e),n.localSubtitle&&this.add(Xe);for(var o=0;o0&&void 0!==arguments[0]?arguments[0]:{};this.isEnd||(this.art.switchUrl(e.url),this.art.once("video:timeupdate",(function(){t.art.emit("ads:start",e)})),this.art.once("video:ended",(function(){var e=t.next;e?(t.index+=1,t.play(e)):t.end()})))}},{key:"end",value:function(){this.isEnd||(this.isEnd=!0,this.playing=!1,this.art.option.url=this.urlCache,this.art.switchUrl(this.urlCache),this.art.emit("ads:end"))}}]),e}(),Je=function e(r){t(this,e);for(var n=r.option,o=r.events.proxy,i=r.template.$video,a=0;a0&&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"4.2.3"}},{key:"env",get:function(){return"production"}},{key:"build",get:function(){return"1641779611573"}},{key:"config",get:function(){return dt}},{key:"utils",get:function(){return et}},{key:"scheme",get:function(){return ft}},{key:"Emitter",get:function(){return p}},{key:"validator",get:function(){return u}},{key:"kindOf",get:function(){return u.kindOf}},{key:"html",get:function(){return vt.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,useSSR:!1,ads:[],layers:[],contextmenu:[],controls:[],settings:[],quality:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,width:160,height:90,column:10},subtitle:{url:"",type:"",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.2.3 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),er})); diff --git a/packages/artplayer/dist/artplayer.js b/packages/artplayer/dist/artplayer.js index a08ecac0e..0624ec03f 100644 --- a/packages/artplayer/dist/artplayer.js +++ b/packages/artplayer/dist/artplayer.js @@ -1,8 +1,8 @@ /*! - * artplayer.js v4.2.2 + * artplayer.js v4.2.3 * Github: https://github.com/zhw2590582/ArtPlayer#readme * (c) 2017-2022 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).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 m(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(e.querySelectorAll(t))}function b(t,e){return t.classList.add(e)}function w(t,e){return t.classList.remove(e)}function x(t,e){return t.classList.contains(e)}function O(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}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 R(t,e){S(t).forEach((function(t){return w(t,e)})),b(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 $(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 D(t,e){return t.composedPath&&t.composedPath().indexOf(e)>-1}function z(t,e){return e.parentNode.replaceChild(t,e),t}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 C(t,e,r){return C=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},C.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 C(t,arguments,s(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),o(n,t)},A(t)}function L(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=s(t);if(e){var o=s(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var M=function(e){i(o,e);var r=L(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 q(t,e){if(!t)throw new M(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 B(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function I(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 V(t){return t.includes("?")?V(t.split("?")[0]):t.includes("#")?V(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 H(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(e){return setTimeout(e,t)}))}function J(t,e){var r,n,o=!1;return function i(){for(var a=arguments.length,c=new Array(a),s=0;s0?[e,r,n]:[r,n]).map((function(t){return t<10?"0".concat(t):String(t)})).join(":")}function tt(t){return t.replace(/[&<>'"]/g,(function(t){return{"&":"&","<":"<",">":">","'":"'",'"':"""}[t]||t}))}var et=Object.freeze({__proto__:null,query:g,queryAll:m,addClass:b,removeClass:w,hasClass:x,append:O,remove:function(t){return t.parentNode.removeChild(t)},setStyle:k,setStyles:j,getStyle:P,sublings:S,inverseClass:R,tooltip:E,isInViewport:$,includeFromEvent:D,replaceElement:z,ArtPlayerError:M,errorHandle:q,srtToVtt:F,vttToBlob:B,assToVtt:I,getExt:V,download:W,def:U,has:X,get:Q,mergeDeep:Y,sleep:Z,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(f);case"regexp":return t.test(f);default:return!1}}))}}]),e}(),vt=function(){function e(r){var n=this;t(this,e),this.art=r;var o=r.option,i=r.constructor,a=r.whitelist;o.container instanceof Element?this.$container=o.container:(this.$container=g(o.container),q(this.$container,"No container element found by ".concat(o.container)));var c=this.$container.tagName.toLowerCase();q("div"===c,"Unsupported container element type, only support 'div' but got '".concat(c,"'")),q(i.instances.every((function(t){return t.template.$container!==n.$container})),"Cannot mount multiple instances on the same dom element"),this.query=this.query.bind(this),this.$container.dataset.artId=r.id,this.$original=this.$container.cloneNode(!0),a.state?this.desktop():this.mobile()}return r(e,[{key:"query",value:function(t){return g(t,this.$container)}},{key:"desktop",value:function(){var t=this.art.option;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"),t.backdrop&&(b(this.$settingInner,"art-backdrop-filter"),b(this.$contextmenu,"art-backdrop-filter"),b(this.$info,"art-backdrop-filter")),d&&b(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?z(this.$original,this.$container):b(this.$player,"art-destroy")}}],[{key:"html",get:function(){return'
Player version:
4.2.2
Video url:
Video volume:
Video time:
Video duration:
Video resolution:
x
[x]
xD7
'}}]),e}(),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":"未发现字幕"},gt={"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":"未發現字幕"},mt=function(){function e(r){t(this,e),this.art=r,this.languages={"zh-cn":yt,"zh-tw":gt},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=Y(this.languages,t),this.init()}}]),e}();var bt={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*l/s;k(r,"width","".concat(100*h,"%")),k(r,"height","100%"),k(r,"padding","0 ".concat((u-u*h)/2,"px"))}else{var v=s/d/l;k(r,"width","100%"),k(r,"height","".concat(100*v,"%")),k(r,"padding","".concat((p-p*v)/2,"px 0"))}n.dataset.aspectRatio=e}i.show="".concat(o.get("Aspect ratio"),": ").concat("default"===e?o.get("Default"):e),t.emit("aspectRatio",e)}}),U(t,"aspectRatioReset",{set:function(e){if(e&&t.aspectRatio){var r=t.aspectRatio;t.aspectRatio=r}}})}(r),function(t){var e=t.option,r=t.notice,n=t.template.$video,o=document.createElement("canvas");U(t,"getDataURL",{value:function(){return new Promise((function(t,e){try{o.width=n.videoWidth,o.height=n.videoHeight,o.getContext("2d").drawImage(n,0,0),t(o.toDataURL("image/png"))}catch(t){r.show=t,e(t)}}))}}),U(t,"getBlobUrl",{value:function(){return new Promise((function(t,e){try{o.width=n.videoWidth,o.height=n.videoHeight,o.getContext("2d").drawImage(n,0,0),o.toBlob((function(e){t(URL.createObjectURL(e))}))}catch(t){r.show=t,e(t)}}))}}),U(t,"screenshot",{value:function(){return t.getDataURL().then((function(r){return W(r,"".concat(e.title||"artplayer","_").concat(K(n.currentTime),".png")),t.emit("screenshot",r),r}))}})}(r),xt(r),function(t){var e=t.template.$player;U(t,"fullscreenWeb",{get:function(){return x(e,"art-fullscreen-web")},set:function(r){r?(b(e,"art-fullscreen-web"),t.aspectRatioReset=!0,t.autoSize=!1,t.emit("resize"),t.emit("fullscreenWeb",!0)):(w(e,"art-fullscreen-web"),t.aspectRatioReset=!0,t.autoSize=t.option.autoSize,t.emit("resize"),t.emit("fullscreenWeb"))}})}(r),Ot(r),function(t){var e=t.template.$video;U(t,"loaded",{get:function(){return t.loadedTime/e.duration}}),U(t,"loadedTime",{get:function(){return e.buffered.length?e.buffered.end(e.buffered.length-1):0}})}(r),function(t){U(t,"played",{get:function(){return t.currentTime/t.duration}})}(r),function(t){var e=t.template.$video;U(t,"playing",{get:function(){return!!(e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>2)}})}(r),function(t){var e=t.template,r=e.$container,n=e.$player,o=e.$video;U(t,"autoSize",{get:function(){return x(r,"art-auto-size")},set:function(e){if(e){var i=o.videoWidth,a=o.videoHeight,c=r.getBoundingClientRect(),s=c.width,l=c.height,u=i/a,p=s/l;if(b(r,"art-auto-size"),p>u)k(n,"width","".concat(l*u/s*100,"%")),k(n,"height","100%");else{var f=s/u/l*100;k(n,"width","100%"),k(n,"height","".concat(f,"%"))}t.emit("autoSize",{width:t.width,height:t.height})}else w(r,"art-auto-size"),k(n,"width",null),k(n,"height",null),t.emit("autoSize")}})}(r),function(t){U(t,"rect",{get:function(){return t.template.$player.getBoundingClientRect()}});for(var e=["bottom","height","left","right","top","width"],r=function(r){var n=e[r];U(t,n,{get:function(){return t.rect[n]}})},n=0;n=1?(e=[n,o],t.emit("loop",e)):(e=[],t.emit("loop"))}else e=[],t.emit("loop")}}),t.on("video:timeupdate",(function(){e.length&&(t.currentTimee[1])&&(t.seek=e[0])}))}(r),function(t){var e=t.template,r=e.$video,n=e.$player,o=t.i18n,i=t.notice;U(t,"rotate",{get:function(){return Number(n.dataset.rotate)||0},set:function(e){e||(e=0);var a=[-270,-180,-90,0,90,180,270];if(q(a.includes(e),"'rotate' only accept ".concat(a.toString()," as parameters")),0===e)delete n.dataset.rotate,k(r,"transform",null);else{t.flip=!1,t.autoSize=!0,n.dataset.rotate=e;var c=function(){var t=r.videoWidth,e=r.videoHeight;return t>e?e/t:t/e},s=0,l=1;switch(e){case-270:s=90,l=c();break;case-180:s=180;break;case-90:s=270,l=c();break;case 90:s=90,l=c();break;case 180:s=180;break;case 270:s=270,l=c()}k(r,"transform","rotate(".concat(s,"deg) scale(").concat(l,")"))}i.show="".concat(o.get("Rotate"),": ").concat(e,"°"),t.emit("rotate",e)}}),U(t,"rotateReset",{set:function(e){if(e&&t.rotate){var r=t.rotate;t.rotate=r}}})}(r),function(t){var e=t.option,r=t.template.$poster;U(t,"poster",{get:function(){return e.poster},set:function(t){e.poster=t,k(r,"backgroundImage","url(".concat(t,")"))}})}(r),function(t){var e=t.option,r=t.template,n=r.$container,o=r.$video,i=n.style.height;U(t,"autoHeight",{get:function(){return x(n,"art-auto-height")},set:function(r){if(r){var a=n.clientWidth,c=o.videoHeight*(a/o.videoWidth);k(n,"height",c+"px"),b(n,"art-auto-height"),t.autoSize=e.autoSize,t.emit("autoHeight",c)}else k(n,"height",i),w(n,"art-auto-height"),t.autoSize=e.autoSize,t.emit("autoHeight")}})}(r),function(t){var e=t.option,r=t.template.$player;U(t,"theme",{get:function(){return getComputedStyle(r).getPropertyValue("--theme")},set:function(t){e.theme=t,r.style.setProperty("--theme",t)}})}(r),function(t){U(t,"title",{get:function(){return t.option.title},set:function(e){t.option.title=e}})}(r),function(t){var e=["mini","pip","fullscreen","fullscreenWeb"];!function(e){for(var r=function(r){var n=e[r];t.on(n,(function(){t[n]&&e.filter((function(t){return t!==n})).forEach((function(e){t[e]&&(t[e]=!1)}))}))},n=0;n=Number(o.dataset.index)}));return a?a.insertAdjacentElement("beforebegin",o):O(this.$parent,o),r.html&&O(o,r.html),r.style&&j(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&&b(o,"art-control-onlyText"),U(this,n,{value:o}),o}}},{key:"selector",value:function(t,e){var r=this,n=this.art.events,o=n.hover,i=n.proxy;b(e,"art-control-selector");var a=document.createElement("div");b(a,"art-selector-value"),O(a,t.html),e.innerText="",O(e,a);var c=t.selector.map((function(t,e){return'
').concat(t.html,"
")})).join(""),s=document.createElement("div");b(s,"art-selector-list"),O(s,c),O(e,s);var l=function(){var t=P(e,"width")/2-P(s,"width")/2;s.style.left="".concat(t,"px")};o(e,l),i(s,"click",(function(e){var n=(e.composedPath()||[]).find((function(t){return x(t,"art-selector-item")}));if(n){R(n,"art-current");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)}l(),r.art.emit("selector",i,n)}}))}}]),e}();function Rt(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 i=!1,a=g(".art-progress-loaded",t),c=g(".art-progress-played",t),s=g(".art-progress-highlight",t),l=g(".art-progress-indicator",t),u=g(".art-progress-tip",t);k(c,"backgroundColor","var(--theme)");var p=14;function f(t,e){"loaded"===t&&k(a,"width","".concat(100*e,"%")),"played"===t&&(k(c,"width","".concat(100*e,"%")),k(l,"left","calc(".concat(100*e,"% - ").concat(p/2,"px)")))}r.indicator?(p=16,O(l,r.indicator)):j(l,{backgroundColor:"var(--theme)"}),j(l,{left:"-".concat(p/2,"px"),width:"".concat(p,"px"),height:"".concat(p,"px")});for(var d=0;d'))}f("loaded",e.loaded),e.on("video:progress",(function(){f("loaded",e.loaded)})),e.on("video:timeupdate",(function(){f("played",e.played)})),e.on("video:ended",(function(){f("played",1)})),o(t,"mousemove",(function(r){k(u,"display","block"),D(r,s)?function(r){var n=qt(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=qt(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)})),o(t,"mouseout",(function(){k(u,"display","none")})),o(t,"click",(function(t){if(t.target!==l){var r=qt(e,t),n=r.second;f("played",r.percentage),e.seek=n}})),o(l,"mousedown",(function(){i=!0})),o(document,"mousemove",(function(t){if(i){var r=qt(e,t),n=r.second;f("played",r.percentage),e.seek=n}})),o(document,"mouseup",(function(){i&&(i=!1)}))}})}}function Bt(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 It(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 Zt(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 Jt(t){for(var e=1;e=3e3&&(r.show=!1,b(a,"art-hide-cursor"),w(a,"art-hover"))})),e.once("ready",(function(){r.add(Ft({name:"progress",disable:i.isLive,position:"top",index:10})),r.add(Yt({name:"thumbnails",disable:!i.thumbnails.url||i.isLive,position:"top",index:20})),r.add(function(t){return function(e){return ee(ee({},t),{},{mounted:function(t){var r=O(t,''),n=O(t,'');e.on("loop",(function(o){o?(k(t,"display","block"),k(r,"left","calc(".concat(o[0]/e.duration*100,"% - ").concat(r.clientWidth,"px)")),k(n,"left","".concat(o[1]/e.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=O(t,n.play),a=O(t,n.pause);function c(){k(i,"display","flex"),k(a,"display","none")}function s(){k(i,"display","none"),k(a,"display","flex")}E(i,o.get("Play")),E(a,o.get("Pause")),r(i,"click",(function(){e.play()})),r(a,"click",(function(){e.pause()})),e.playing?s():c(),e.on("video:playing",(function(){s()})),e.on("video:pause",(function(){c()}))}})}}({name:"playAndPause",disable:!1,position:"left",index:10})),r.add(function(t){return function(e){return Nt(Nt({},t),{},{mounted:function(t){var r=e.events.proxy,n=e.icons,o=e.i18n,i=!1,a=O(t,n.volume),c=O(t,n.volumeClose),s=O(t,'
'),l=O(s,'
');function u(t){var e=s.getBoundingClientRect().left;return G(t.pageX-e-6,0,54)/48}function p(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.7;if(e.muted||0===t)k(a,"display","none"),k(c,"display","flex"),k(l,"left","0");else{var r=48*t;k(a,"display","flex"),k(c,"display","none"),k(l,"left","".concat(r,"px"))}}E(a,o.get("Mute")),k(c,"display","none"),d&&k(s,"display","none"),p(e.volume),e.on("video:volumechange",(function(){p(e.volume)})),r(a,"click",(function(){e.muted=!0})),r(c,"click",(function(){e.muted=!1})),r(s,"click",(function(t){e.muted=!1,e.volume=u(t)})),r(l,"mousedown",(function(){i=!0})),r(t,"mousemove",(function(t){i&&(e.muted=!1,e.volume=u(t))})),r(document,"mouseup",(function(){i&&(i=!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(K(e.currentTime)," / ").concat(K(e.duration));r!==t.innerText&&(t.innerText=r)}r();for(var n=["video:loadedmetadata","video:timeupdate","video:progress"],o=0;o0.50.75').concat(r.get("Normal"),'1.251.52.0'),click:function(t,r){var n=r.target.dataset.rate;n&&(e.playbackRate=Number(n),t.show=!1)},mounted:function(t){e.on("playbackRate",(function(e){var r=m("span",t).find((function(t){return Number(t.dataset.rate)===e}));r&&R(r,"art-current")}))}})}}({disable:!i.playbackRate,name:"playbackRate",index:10})),o.add(function(t){return function(e){var r=e.i18n;return ce(ce({},t),{},{html:"".concat(r.get("Aspect ratio"),':').concat(r.get("Default"),'4:316:9'),click:function(t,r){var n=r.target.dataset.ratio;n&&(e.aspectRatio=n,t.show=!1)},mounted:function(t){e.on("aspectRatio",(function(e){var r=m("span",t).find((function(t){return t.dataset.ratio===e}));r&&R(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 pe(pe({},t),{},{html:'ArtPlayer 4.2.2'})}({disable:!1,name:"version",index:40})),o.add(function(t){return function(e){return de(de({},t),{},{html:e.i18n.get("Close"),click:function(t){t.show=!1}})}}({disable:!1,name:"close",index:60}));for(var t=0;tl+a&&(h=a-d),r+f>u+i&&(v=i-f),j(s,{top:"".concat(v,"px"),left:"".concat(h,"px")})})),l(c,"click",(function(t){D(t,s)||(o.show=!1)})),e.on("blur",(function(){o.show=!1}))})),o}return n}(St);function ye(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=s(t);if(e){var o=s(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=ye(o);function o(e){var r;return t(this,o),(r=n.call(this,e)).name="info",e.once("ready",(function(){r.init()})),r}return r(o,[{key:"init",value:function(){var t=this,e=this.art,r=e.events.proxy,n=e.template,o=n.$infoPanel,i=n.$infoClose,a=n.$video;r(i,"click",(function(){t.show=!1}));var c=null,s=m("[data-video]",o)||[];this.art.on("destroy",(function(){clearTimeout(c)})),function t(){for(var e=0;e".concat(tt(t),"

")})).join(""),this.art.emit("subtitleUpdate",this.activeCue.text))}},{key:"switch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.art,n=r.i18n,o=r.notice,i=r.option,a=be(be(be({},i.subtitle),e),{},{url:t});return this.init(a).then((function(t){return e.name&&(o.show="".concat(n.get("Switch subtitle"),": ").concat(e.name)),t}))}},{key:"init",value:function(t){var e=this;if(u(t,ft.subtitle),t.url){var r=this.art,n=r.notice,o=r.events.proxy,i=r.template,a=i.$subtitle,c=i.$video;if(!i.$track){var s=document.createElement("track");s.default=!0,s.kind="metadata",c.appendChild(s),this.art.template.$track=s,o(this.textTrack,"cuechange",this.update.bind(this))}return this.style(t.style),this.bilingual=t.bilingual,q(window.fetch,"fetch not support"),fetch(t.url).then((function(t){return t.arrayBuffer()})).then((function(r){q(window.TextDecoder,"TextDecoder not support");var n=new TextDecoder(t.encoding).decode(r);switch(e.art.emit("subtitleLoad",t.url),t.type||V(t.url)){case"srt":return B(F(n));case"ass":return B(I(n));case"vtt":return B(n);default:return t.url}})).then((function(t){return a.innerHTML="",e.url===t||(URL.revokeObjectURL(e.url),e.art.template.$track.src=t,e.art.emit("subtitleSwitch",t)),t})).catch((function(t){throw n.show=t,t}))}}}]),o}(St);var Oe=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){D(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(){b(r,"art-hover"),t.emit("hover",!0)}),(function(){w(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=J((function(){t.normalSize&&(t.autoSize=r.autoSize),t.aspectRatioReset=!0,t.emit("resize")}),500);e.proxy(window,["orientationchange","resize"],(function(){n()})),screen&&screen.orientation&&screen.orientation.onchange&&e.proxy(screen.orientation,"change",(function(){n()}))}(r,n),function(t,e){if(d&&!t.option.isLive){var r=t.notice,n=t.template.$video,o=!1,i=0,a=0;e.proxy(n,"touchstart",(function(t){1===t.touches.length&&(o=!0,i=t.touches[0].clientX)})),e.proxy(document,"touchmove",(function(e){if(1===e.touches.length&&o){var c=G((e.touches[0].clientX-i)/n.clientWidth,-1,1);a=G(t.currentTime+60*c,0,t.duration),r.show="".concat(K(a)," / ").concat(K(t.duration))}})),e.proxy(document,"touchend",(function(){o&&a&&(t.seek=a),o=!1,i=0,a=0}))}}(r,n),function(t,e){var r=t.option,n=t.template.$container,o=J((function(){t.emit("view",$(n,50))}),200);e.proxy(window,"scroll",(function(){o()})),t.on("view",(function(e){r.autoMini&&(t.mini=!e)}))}(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 M("Unable to get Image"));(o=new Image).src=t}if(o.complete)return r(o);e.proxy(o,"load",(function(){return r(o)})),e.proxy(o,"error",(function(){return n(new M("Failed to load Image: ".concat(o.src)))}))}))}},{key:"destroy",value:function(){for(var t=0;t',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){U(n,t,{get:function(){var e=document.createElement("i");return b(e,"art-icon"),b(e,"art-icon-".concat(t)),O(e,o[t]),e}})}))};function Ce(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,r){var n=r.target.dataset.value;n&&(e.flip=n)},mounted:function(t){e.on("flip",(function(e){var r=m("button",t).find((function(t){return t.dataset.value===e}));r&&R(r.parentElement,"current")}))}})}}({disable:!i.flip,name:"flip"})),o.add(function(t){return function(e){var r=e.i18n;return Me(Me({},t),{},{html:'
'.concat(r.get("Rotate"),': 0°
'),click:function(t,r){var n=r.target.dataset.value;if(n){var o=e.rotate+Number(n);e.rotate=360===o||-360===o?0:o}else e.rotate=0},mounted:function(t){var r=g(".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;return Fe(Fe({},t),{},{html:'
'.concat(r.get("Aspect ratio"),'
'),click:function(t,r){var n=r.target.dataset.value;n&&(e.aspectRatio=n)},mounted:function(t){e.on("aspectRatio",(function(e){var r=m("button",t).find((function(t){return t.dataset.value===e}));r&&R(r.parentElement,"current")}))}})}}({disable:!i.aspectRatio,name:"aspectRatio"})),o.add(function(t){return function(e){var r=e.i18n,n=e.events.proxy;return Ie(Ie({},t),{},{html:'
'.concat(r.get("Play speed"),': 1.0x
'),mounted:function(t){var r=g(".art-setting-range input",t),o=g(".art-subtitle-value",t);n(r,"change",(function(){var t=r.value;o.innerText=t,e.playbackRate=Number(t)})),e.on("playbackRate",(function(t){t&&r.value!==t&&(r.value=t,o.innerText=t)}))}})}}({disable:!i.playbackRate,name:"playbackRate"}));for(var t=0;t'.concat(e.get("Subtitle offset time"),': 0s
'),mounted:function(e){var o=g(".art-setting-range input",e),i=g(".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 Ue(t){var e=t.constructor.utils.clamp,r=t.setting,n=t.notice,o=t.template,i=t.i18n;r.add(Ne);var a=[];return t.on("subtitle:switch",(function(){a=[]})),{name:"subtitleOffset",offset:function(r){if(o.$track&&o.$track.track){for(var c=Array.from(o.$track.track.cues),s=e(r,-5,5),l=0;l');k(t,"position","relative"),j(r,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(r,"change",(function(){s(r.files[0])}))}return e(o,"dragover",(function(t){t.preventDefault()})),e(o,"drop",(function(t){t.preventDefault(),s(t.dataTransfer.files[0])})),t.once("ready",(function(){a.add({title:"Local Video",name:"localVideo",index:30,html:'
'.concat(c.get("Local Video"),'
').concat(c.get("Open"),'
'),mounted:function(e){var r=g(".art-upload-btn",e),n=g(".art-upload-value",e);t.on("localVideo",(function(t){n.textContent=t.name,n.title=t.name})),l(r)}})})),{name:"localVideo",attach:l}}function Xe(t){var e=t.events.proxy,r=t.subtitle,n=t.setting,o=t.i18n;function i(n){var o=O(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=V(e.name);["ass","vtt","srt"].includes(n)?(r.switch(URL.createObjectURL(e),{name:e.name,ext:n}),t.emit("localSubtitle",e)):q(!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=g(".art-upload-btn",e),n=g(".art-upload-value",e);t.on("localSubtitle",(function(t){n.textContent=t.name,n.title=t.name})),i(r)}})})),{name:"localSubtitle",attach:i}}function Qe(t){return t.layers.add({name:"miniProgressBar",style:{display:"none",position:"absolute",left:0,right:0,bottom:0,height:"2px",backgroundColor:"var(--theme)"},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*t.played,"%")}))}}),{name:"miniProgressBar"}}var Ye=function(){function e(r){t(this,e),this.art=r,this.id=0;var n=r.option;n.subtitle.url&&n.subtitleOffset&&this.add(Ue),!n.isLive&&n.miniProgressBar&&this.add(Qe),n.localVideo&&this.add(_e),n.localSubtitle&&this.add(Xe);for(var o=0;o0&&void 0!==arguments[0]?arguments[0]:{};this.isEnd||(this.art.switchUrl(e.url),this.art.once("video:timeupdate",(function(){t.art.emit("ads:start",e)})),this.art.once("video:ended",(function(){var e=t.next;e?(t.index+=1,t.play(e)):t.end()})))}},{key:"end",value:function(){this.isEnd||(this.isEnd=!0,this.playing=!1,this.art.option.url=this.urlCache,this.art.switchUrl(this.urlCache),this.art.emit("ads:end"))}}]),e}(),Je=function e(r){t(this,e);for(var n=r.option,o=r.events.proxy,i=r.template.$video,a=0;a0&&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"4.2.2"}},{key:"env",get:function(){return"production"}},{key:"build",get:function(){return"1641598133160"}},{key:"config",get:function(){return dt}},{key:"utils",get:function(){return et}},{key:"scheme",get:function(){return ft}},{key:"Emitter",get:function(){return p}},{key:"validator",get:function(){return u}},{key:"kindOf",get:function(){return u.kindOf}},{key:"html",get:function(){return vt.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,useSSR:!1,ads:[],layers:[],contextmenu:[],controls:[],settings:[],quality:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,width:160,height:90,column:10},subtitle:{url:"",type:"",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.2.2 %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 m(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(e.querySelectorAll(t))}function b(t,e){return t.classList.add(e)}function w(t,e){return t.classList.remove(e)}function x(t,e){return t.classList.contains(e)}function O(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}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 R(t,e){S(t).forEach((function(t){return w(t,e)})),b(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 $(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 D(t,e){return t.composedPath&&t.composedPath().indexOf(e)>-1}function z(t,e){return e.parentNode.replaceChild(t,e),t}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 C(t,e,r){return C=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},C.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 C(t,arguments,s(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),o(n,t)},A(t)}function L(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=s(t);if(e){var o=s(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var M=function(e){i(o,e);var r=L(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 q(t,e){if(!t)throw new M(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 B(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function I(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 V(t){return t.includes("?")?V(t.split("?")[0]):t.includes("#")?V(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 N(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(e){return setTimeout(e,t)}))}function J(t,e){var r,n,o=!1;return function i(){for(var a=arguments.length,c=new Array(a),s=0;s0?[e,r,n]:[r,n]).map((function(t){return t<10?"0".concat(t):String(t)})).join(":")}function tt(t){return t.replace(/[&<>'"]/g,(function(t){return{"&":"&","<":"<",">":">","'":"'",'"':"""}[t]||t}))}var et=Object.freeze({__proto__:null,query:g,queryAll:m,addClass:b,removeClass:w,hasClass:x,append:O,remove:function(t){return t.parentNode.removeChild(t)},setStyle:k,setStyles:j,getStyle:P,sublings:S,inverseClass:R,tooltip:E,isInViewport:$,includeFromEvent:D,replaceElement:z,ArtPlayerError:M,errorHandle:q,srtToVtt:F,vttToBlob:B,assToVtt:I,getExt:V,download:W,def:U,has:X,get:Q,mergeDeep:Y,sleep:Z,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(f);case"regexp":return t.test(f);default:return!1}}))}}]),e}(),vt=function(){function e(r){var n=this;t(this,e),this.art=r;var o=r.option,i=r.constructor,a=r.whitelist;o.container instanceof Element?this.$container=o.container:(this.$container=g(o.container),q(this.$container,"No container element found by ".concat(o.container)));var c=this.$container.tagName.toLowerCase();q("div"===c,"Unsupported container element type, only support 'div' but got '".concat(c,"'")),q(i.instances.every((function(t){return t.template.$container!==n.$container})),"Cannot mount multiple instances on the same dom element"),this.query=this.query.bind(this),this.$container.dataset.artId=r.id,this.$original=this.$container.cloneNode(!0),a.state?this.desktop():this.mobile()}return r(e,[{key:"query",value:function(t){return g(t,this.$container)}},{key:"desktop",value:function(){var t=this.art.option;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"),t.backdrop&&(b(this.$settingInner,"art-backdrop-filter"),b(this.$contextmenu,"art-backdrop-filter"),b(this.$info,"art-backdrop-filter")),d&&b(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?z(this.$original,this.$container):b(this.$player,"art-destroy")}}],[{key:"html",get:function(){return'
Player version:
4.2.3
Video url:
Video volume:
Video time:
Video duration:
Video resolution:
x
[x]
xD7
'}}]),e}(),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":"未发现字幕"},gt={"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":"未發現字幕"},mt=function(){function e(r){t(this,e),this.art=r,this.languages={"zh-cn":yt,"zh-tw":gt},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=Y(this.languages,t),this.init()}}]),e}();var bt={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*l/s;k(r,"width","".concat(100*h,"%")),k(r,"height","100%"),k(r,"padding","0 ".concat((u-u*h)/2,"px"))}else{var v=s/d/l;k(r,"width","100%"),k(r,"height","".concat(100*v,"%")),k(r,"padding","".concat((p-p*v)/2,"px 0"))}n.dataset.aspectRatio=e}i.show="".concat(o.get("Aspect ratio"),": ").concat("default"===e?o.get("Default"):e),t.emit("aspectRatio",e)}}),U(t,"aspectRatioReset",{set:function(e){if(e&&t.aspectRatio){var r=t.aspectRatio;t.aspectRatio=r}}})}(r),function(t){var e=t.option,r=t.notice,n=t.template.$video,o=document.createElement("canvas");U(t,"getDataURL",{value:function(){return new Promise((function(t,e){try{o.width=n.videoWidth,o.height=n.videoHeight,o.getContext("2d").drawImage(n,0,0),t(o.toDataURL("image/png"))}catch(t){r.show=t,e(t)}}))}}),U(t,"getBlobUrl",{value:function(){return new Promise((function(t,e){try{o.width=n.videoWidth,o.height=n.videoHeight,o.getContext("2d").drawImage(n,0,0),o.toBlob((function(e){t(URL.createObjectURL(e))}))}catch(t){r.show=t,e(t)}}))}}),U(t,"screenshot",{value:function(){return t.getDataURL().then((function(r){return W(r,"".concat(e.title||"artplayer","_").concat(K(n.currentTime),".png")),t.emit("screenshot",r),r}))}})}(r),xt(r),function(t){var e=t.template.$player;U(t,"fullscreenWeb",{get:function(){return x(e,"art-fullscreen-web")},set:function(r){r?(b(e,"art-fullscreen-web"),t.aspectRatioReset=!0,t.autoSize=!1,t.emit("resize"),t.emit("fullscreenWeb",!0)):(w(e,"art-fullscreen-web"),t.aspectRatioReset=!0,t.autoSize=t.option.autoSize,t.emit("resize"),t.emit("fullscreenWeb"))}})}(r),Ot(r),function(t){var e=t.template.$video;U(t,"loaded",{get:function(){return t.loadedTime/e.duration}}),U(t,"loadedTime",{get:function(){return e.buffered.length?e.buffered.end(e.buffered.length-1):0}})}(r),function(t){U(t,"played",{get:function(){return t.currentTime/t.duration}})}(r),function(t){var e=t.template.$video;U(t,"playing",{get:function(){return!!(e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>2)}})}(r),function(t){var e=t.template,r=e.$container,n=e.$player,o=e.$video;U(t,"autoSize",{get:function(){return x(r,"art-auto-size")},set:function(e){if(e){var i=o.videoWidth,a=o.videoHeight,c=r.getBoundingClientRect(),s=c.width,l=c.height,u=i/a,p=s/l;if(b(r,"art-auto-size"),p>u)k(n,"width","".concat(l*u/s*100,"%")),k(n,"height","100%");else{var f=s/u/l*100;k(n,"width","100%"),k(n,"height","".concat(f,"%"))}t.emit("autoSize",{width:t.width,height:t.height})}else w(r,"art-auto-size"),k(n,"width",null),k(n,"height",null),t.emit("autoSize")}})}(r),function(t){U(t,"rect",{get:function(){return t.template.$player.getBoundingClientRect()}});for(var e=["bottom","height","left","right","top","width"],r=function(r){var n=e[r];U(t,n,{get:function(){return t.rect[n]}})},n=0;n=1?(e=[n,o],t.emit("loop",e)):(e=[],t.emit("loop"))}else e=[],t.emit("loop")}}),t.on("video:timeupdate",(function(){e.length&&(t.currentTimee[1])&&(t.seek=e[0])}))}(r),function(t){var e=t.template,r=e.$video,n=e.$player,o=t.i18n,i=t.notice;U(t,"rotate",{get:function(){return Number(n.dataset.rotate)||0},set:function(e){e||(e=0);var a=[-270,-180,-90,0,90,180,270];if(q(a.includes(e),"'rotate' only accept ".concat(a.toString()," as parameters")),0===e)delete n.dataset.rotate,k(r,"transform",null);else{t.flip=!1,t.autoSize=!0,n.dataset.rotate=e;var c=function(){var t=r.videoWidth,e=r.videoHeight;return t>e?e/t:t/e},s=0,l=1;switch(e){case-270:s=90,l=c();break;case-180:s=180;break;case-90:s=270,l=c();break;case 90:s=90,l=c();break;case 180:s=180;break;case 270:s=270,l=c()}k(r,"transform","rotate(".concat(s,"deg) scale(").concat(l,")"))}i.show="".concat(o.get("Rotate"),": ").concat(e,"°"),t.emit("rotate",e)}}),U(t,"rotateReset",{set:function(e){if(e&&t.rotate){var r=t.rotate;t.rotate=r}}})}(r),function(t){var e=t.option,r=t.template.$poster;U(t,"poster",{get:function(){return e.poster},set:function(t){e.poster=t,k(r,"backgroundImage","url(".concat(t,")"))}})}(r),function(t){var e=t.option,r=t.template,n=r.$container,o=r.$video,i=n.style.height;U(t,"autoHeight",{get:function(){return x(n,"art-auto-height")},set:function(r){if(r){var a=n.clientWidth,c=o.videoHeight*(a/o.videoWidth);k(n,"height",c+"px"),b(n,"art-auto-height"),t.autoSize=e.autoSize,t.emit("autoHeight",c)}else k(n,"height",i),w(n,"art-auto-height"),t.autoSize=e.autoSize,t.emit("autoHeight")}})}(r),function(t){var e=t.option,r=t.template.$player;U(t,"theme",{get:function(){return getComputedStyle(r).getPropertyValue("--theme")},set:function(t){e.theme=t,r.style.setProperty("--theme",t)}})}(r),function(t){U(t,"title",{get:function(){return t.option.title},set:function(e){t.option.title=e}})}(r),function(t){var e=["mini","pip","fullscreen","fullscreenWeb"];!function(e){for(var r=function(r){var n=e[r];t.on(n,(function(){t[n]&&e.filter((function(t){return t!==n})).forEach((function(e){t[e]&&(t[e]=!1)}))}))},n=0;n=Number(o.dataset.index)}));return a?a.insertAdjacentElement("beforebegin",o):O(this.$parent,o),r.html&&O(o,r.html),r.style&&j(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&&b(o,"art-control-onlyText"),U(this,n,{value:o}),o}}},{key:"selector",value:function(t,e){var r=this,n=this.art.events,o=n.hover,i=n.proxy;b(e,"art-control-selector");var a=document.createElement("div");b(a,"art-selector-value"),O(a,t.html),e.innerText="",O(e,a);var c=t.selector.map((function(t,e){return'
').concat(t.html,"
")})).join(""),s=document.createElement("div");b(s,"art-selector-list"),O(s,c),O(e,s);var l=function(){var t=P(e,"width")/2-P(s,"width")/2;s.style.left="".concat(t,"px")};o(e,l),i(s,"click",(function(e){var n=(e.composedPath()||[]).find((function(t){return x(t,"art-selector-item")}));if(n){R(n,"art-current");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)}l(),r.art.emit("selector",i,n)}}))}}]),e}();function Rt(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 i=!1,a=g(".art-progress-loaded",t),c=g(".art-progress-played",t),s=g(".art-progress-highlight",t),l=g(".art-progress-indicator",t),u=g(".art-progress-tip",t);k(c,"backgroundColor","var(--theme)");var p=14;function f(t,e){"loaded"===t&&k(a,"width","".concat(100*e,"%")),"played"===t&&(k(c,"width","".concat(100*e,"%")),k(l,"left","calc(".concat(100*e,"% - ").concat(p/2,"px)")))}r.indicator?(p=16,O(l,r.indicator)):j(l,{backgroundColor:"var(--theme)"}),j(l,{left:"-".concat(p/2,"px"),width:"".concat(p,"px"),height:"".concat(p,"px")});for(var d=0;d'))}f("loaded",e.loaded),e.on("video:progress",(function(){f("loaded",e.loaded)})),e.on("video:timeupdate",(function(){f("played",e.played)})),e.on("video:ended",(function(){f("played",1)})),o(t,"mousemove",(function(r){k(u,"display","block"),D(r,s)?function(r){var n=qt(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=qt(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)})),o(t,"mouseout",(function(){k(u,"display","none")})),o(t,"click",(function(t){if(t.target!==l){var r=qt(e,t),n=r.second;f("played",r.percentage),e.seek=n}})),o(l,"mousedown",(function(){i=!0})),o(document,"mousemove",(function(t){if(i){var r=qt(e,t),n=r.second;f("played",r.percentage),e.seek=n}})),o(document,"mouseup",(function(){i&&(i=!1)})),o(l,"touchstart",(function(t){1===t.touches.length&&(i=!0)})),o(document,"touchmove",(function(t){if(1===t.touches.length&&i){var r=qt(e,t),n=r.second;f("played",r.percentage),e.seek=n}})),o(document,"touchend",(function(){i&&(i=!1)}))}})}}function Bt(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 It(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 Zt(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 Jt(t){for(var e=1;e=3e3&&(r.show=!1,b(a,"art-hide-cursor"),w(a,"art-hover"))})),e.once("ready",(function(){r.add(Ft({name:"progress",disable:i.isLive,position:"top",index:10})),r.add(Yt({name:"thumbnails",disable:!i.thumbnails.url||i.isLive,position:"top",index:20})),r.add(function(t){return function(e){return ee(ee({},t),{},{mounted:function(t){var r=O(t,''),n=O(t,'');e.on("loop",(function(o){o?(k(t,"display","block"),k(r,"left","calc(".concat(o[0]/e.duration*100,"% - ").concat(r.clientWidth,"px)")),k(n,"left","".concat(o[1]/e.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=O(t,n.play),a=O(t,n.pause);function c(){k(i,"display","flex"),k(a,"display","none")}function s(){k(i,"display","none"),k(a,"display","flex")}E(i,o.get("Play")),E(a,o.get("Pause")),r(i,"click",(function(){e.play()})),r(a,"click",(function(){e.pause()})),e.playing?s():c(),e.on("video:playing",(function(){s()})),e.on("video:pause",(function(){c()}))}})}}({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.i18n,i=!1,a=O(t,n.volume),c=O(t,n.volumeClose),s=O(t,'
'),l=O(s,'
');function u(t){var e=s.getBoundingClientRect().left;return G(t.pageX-e-6,0,54)/48}function p(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.7;if(e.muted||0===t)k(a,"display","none"),k(c,"display","flex"),k(l,"left","0");else{var r=48*t;k(a,"display","flex"),k(c,"display","none"),k(l,"left","".concat(r,"px"))}}E(a,o.get("Mute")),k(c,"display","none"),d&&k(s,"display","none"),p(e.volume),e.on("video:volumechange",(function(){p(e.volume)})),r(a,"click",(function(){e.muted=!0})),r(c,"click",(function(){e.muted=!1})),r(s,"click",(function(t){e.muted=!1,e.volume=u(t)})),r(l,"mousedown",(function(){i=!0})),r(t,"mousemove",(function(t){i&&(e.muted=!1,e.volume=u(t))})),r(document,"mouseup",(function(){i&&(i=!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(K(e.currentTime)," / ").concat(K(e.duration));r!==t.innerText&&(t.innerText=r)}r();for(var n=["video:loadedmetadata","video:timeupdate","video:progress"],o=0;o0.50.75').concat(r.get("Normal"),'1.251.52.0'),click:function(t,r){var n=r.target.dataset.rate;n&&(e.playbackRate=Number(n),t.show=!1)},mounted:function(t){e.on("playbackRate",(function(e){var r=m("span",t).find((function(t){return Number(t.dataset.rate)===e}));r&&R(r,"art-current")}))}})}}({disable:!r.playbackRate,name:"playbackRate",index:10})),this.add(function(t){return function(e){var r=e.i18n;return ce(ce({},t),{},{html:"".concat(r.get("Aspect ratio"),':').concat(r.get("Default"),'4:316:9'),click:function(t,r){var n=r.target.dataset.ratio;n&&(e.aspectRatio=n,t.show=!1)},mounted:function(t){e.on("aspectRatio",(function(e){var r=m("span",t).find((function(t){return t.dataset.ratio===e}));r&&R(r,"art-current")}))}})}}({disable:!r.aspectRatio,name:"aspectRatio",index:20})),this.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})),this.add(function(t){return pe(pe({},t),{},{html:'ArtPlayer 4.2.3'})}({disable:!1,name:"version",index:40})),this.add(function(t){return function(e){return de(de({},t),{},{html:e.i18n.get("Close"),click:function(t){t.show=!1}})}}({disable:!1,name:"close",index:60}));for(var c=0;cl+s&&(h=s-d),n+f>u+c&&(v=c-f),j(i,{top:"".concat(v,"px"),left:"".concat(h,"px")})})),a(o,"click",(function(e){D(e,i)||(t.show=!1)})),this.art.on("blur",(function(){t.show=!1}))}}]),o}(St);function ye(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=s(t);if(e){var o=s(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=ye(o);function o(e){var r;return t(this,o),(r=n.call(this,e)).name="info",e.once("ready",(function(){d||r.init()})),r}return r(o,[{key:"init",value:function(){var t=this,e=this.art,r=e.events.proxy,n=e.template,o=n.$infoPanel,i=n.$infoClose,a=n.$video;r(i,"click",(function(){t.show=!1}));var c=null,s=m("[data-video]",o)||[];this.art.on("destroy",(function(){clearTimeout(c)})),function t(){for(var e=0;e".concat(tt(t),"

")})).join(""),this.art.emit("subtitleUpdate",this.activeCue.text))}},{key:"switch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.art,n=r.i18n,o=r.notice,i=r.option,a=be(be(be({},i.subtitle),e),{},{url:t});return this.init(a).then((function(t){return e.name&&(o.show="".concat(n.get("Switch subtitle"),": ").concat(e.name)),t}))}},{key:"init",value:function(t){var e=this;if(u(t,ft.subtitle),t.url){var r=this.art,n=r.notice,o=r.events.proxy,i=r.template,a=i.$subtitle,c=i.$video;if(!i.$track){var s=document.createElement("track");s.default=!0,s.kind="metadata",c.appendChild(s),this.art.template.$track=s,o(this.textTrack,"cuechange",this.update.bind(this))}return this.style(t.style),this.bilingual=t.bilingual,q(window.fetch,"fetch not support"),fetch(t.url).then((function(t){return t.arrayBuffer()})).then((function(r){q(window.TextDecoder,"TextDecoder not support");var n=new TextDecoder(t.encoding).decode(r);switch(e.art.emit("subtitleLoad",t.url),t.type||V(t.url)){case"srt":return B(F(n));case"ass":return B(I(n));case"vtt":return B(n);default:return t.url}})).then((function(t){return a.innerHTML="",e.url===t||(URL.revokeObjectURL(e.url),e.art.template.$track.src=t,e.art.emit("subtitleSwitch",t)),t})).catch((function(t){throw n.show=t,t}))}}}]),o}(St);var Oe=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){D(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(){b(r,"art-hover"),t.emit("hover",!0)}),(function(){w(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=J((function(){t.normalSize&&(t.autoSize=r.autoSize),t.aspectRatioReset=!0,t.emit("resize")}),500);e.proxy(window,["orientationchange","resize"],(function(){n()})),screen&&screen.orientation&&screen.orientation.onchange&&e.proxy(screen.orientation,"change",(function(){n()}))}(r,n),function(t,e){if(d&&!t.option.isLive){var r=t.notice,n=t.template.$video,o=!1,i=0,a=0;e.proxy(n,"touchstart",(function(t){1===t.touches.length&&(o=!0,i=t.touches[0].clientX)})),e.proxy(n,"touchmove",(function(e){if(1===e.touches.length&&o){var c=G((e.touches[0].clientX-i)/n.clientWidth,-1,1);a=G(t.currentTime+60*c,0,t.duration),r.show="".concat(K(a)," / ").concat(K(t.duration))}})),e.proxy(document,"touchend",(function(){o&&a&&(t.seek=a),o=!1,i=0,a=0}))}}(r,n),function(t,e){var r=t.option,n=t.template.$container,o=J((function(){t.emit("view",$(n,50))}),200);e.proxy(window,"scroll",(function(){o()})),t.on("view",(function(e){r.autoMini&&(t.mini=!e)}))}(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 M("Unable to get Image"));(o=new Image).src=t}if(o.complete)return r(o);e.proxy(o,"load",(function(){return r(o)})),e.proxy(o,"error",(function(){return n(new M("Failed to load Image: ".concat(o.src)))}))}))}},{key:"destroy",value:function(){for(var t=0;t',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){U(n,t,{get:function(){var e=document.createElement("i");return b(e,"art-icon"),b(e,"art-icon-".concat(t)),O(e,o[t]),e}})}))};function Ce(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,r){var n=r.target.dataset.value;n&&(e.flip=n)},mounted:function(t){e.on("flip",(function(e){var r=m("button",t).find((function(t){return t.dataset.value===e}));r&&R(r.parentElement,"current")}))}})}}({disable:!i.flip,name:"flip"})),o.add(function(t){return function(e){var r=e.i18n;return Me(Me({},t),{},{html:'
'.concat(r.get("Rotate"),': 0°
'),click:function(t,r){var n=r.target.dataset.value;if(n){var o=e.rotate+Number(n);e.rotate=360===o||-360===o?0:o}else e.rotate=0},mounted:function(t){var r=g(".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;return Fe(Fe({},t),{},{html:'
'.concat(r.get("Aspect ratio"),'
'),click:function(t,r){var n=r.target.dataset.value;n&&(e.aspectRatio=n)},mounted:function(t){e.on("aspectRatio",(function(e){var r=m("button",t).find((function(t){return t.dataset.value===e}));r&&R(r.parentElement,"current")}))}})}}({disable:!i.aspectRatio,name:"aspectRatio"})),o.add(function(t){return function(e){var r=e.i18n,n=e.events.proxy;return Ie(Ie({},t),{},{html:'
'.concat(r.get("Play speed"),': 1.0x
'),mounted:function(t){var r=g(".art-setting-range input",t),o=g(".art-subtitle-value",t);n(r,"change",(function(){var t=r.value;o.innerText=t,e.playbackRate=Number(t)})),e.on("playbackRate",(function(t){t&&r.value!==t&&(r.value=t,o.innerText=t)}))}})}}({disable:!i.playbackRate,name:"playbackRate"}));for(var t=0;t'.concat(e.get("Subtitle offset time"),': 0s
'),mounted:function(e){var o=g(".art-setting-range input",e),i=g(".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 Ue(t){var e=t.constructor.utils.clamp,r=t.setting,n=t.notice,o=t.template,i=t.i18n;r.add(He);var a=[];return t.on("subtitle:switch",(function(){a=[]})),{name:"subtitleOffset",offset:function(r){if(o.$track&&o.$track.track){for(var c=Array.from(o.$track.track.cues),s=e(r,-5,5),l=0;l');k(t,"position","relative"),j(r,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(r,"change",(function(){s(r.files[0])}))}return e(o,"dragover",(function(t){t.preventDefault()})),e(o,"drop",(function(t){t.preventDefault(),s(t.dataTransfer.files[0])})),t.once("ready",(function(){a.add({title:"Local Video",name:"localVideo",index:30,html:'
'.concat(c.get("Local Video"),'
').concat(c.get("Open"),'
'),mounted:function(e){var r=g(".art-upload-btn",e),n=g(".art-upload-value",e);t.on("localVideo",(function(t){n.textContent=t.name,n.title=t.name})),l(r)}})})),{name:"localVideo",attach:l}}function Xe(t){var e=t.events.proxy,r=t.subtitle,n=t.setting,o=t.i18n;function i(n){var o=O(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=V(e.name);["ass","vtt","srt"].includes(n)?(r.switch(URL.createObjectURL(e),{name:e.name,ext:n}),t.emit("localSubtitle",e)):q(!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=g(".art-upload-btn",e),n=g(".art-upload-value",e);t.on("localSubtitle",(function(t){n.textContent=t.name,n.title=t.name})),i(r)}})})),{name:"localSubtitle",attach:i}}function Qe(t){return t.layers.add({name:"miniProgressBar",style:{display:"none",position:"absolute",left:0,right:0,bottom:0,height:"2px",backgroundColor:"var(--theme)"},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*t.played,"%")}))}}),{name:"miniProgressBar"}}var Ye=function(){function e(r){t(this,e),this.art=r,this.id=0;var n=r.option;n.subtitle.url&&n.subtitleOffset&&this.add(Ue),!n.isLive&&n.miniProgressBar&&this.add(Qe),n.localVideo&&this.add(_e),n.localSubtitle&&this.add(Xe);for(var o=0;o0&&void 0!==arguments[0]?arguments[0]:{};this.isEnd||(this.art.switchUrl(e.url),this.art.once("video:timeupdate",(function(){t.art.emit("ads:start",e)})),this.art.once("video:ended",(function(){var e=t.next;e?(t.index+=1,t.play(e)):t.end()})))}},{key:"end",value:function(){this.isEnd||(this.isEnd=!0,this.playing=!1,this.art.option.url=this.urlCache,this.art.switchUrl(this.urlCache),this.art.emit("ads:end"))}}]),e}(),Je=function e(r){t(this,e);for(var n=r.option,o=r.events.proxy,i=r.template.$video,a=0;a0&&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"4.2.3"}},{key:"env",get:function(){return"production"}},{key:"build",get:function(){return"1641779611573"}},{key:"config",get:function(){return dt}},{key:"utils",get:function(){return et}},{key:"scheme",get:function(){return ft}},{key:"Emitter",get:function(){return p}},{key:"validator",get:function(){return u}},{key:"kindOf",get:function(){return u.kindOf}},{key:"html",get:function(){return vt.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,useSSR:!1,ads:[],layers:[],contextmenu:[],controls:[],settings:[],quality:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,width:160,height:90,column:10},subtitle:{url:"",type:"",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.2.3 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),er})); diff --git a/packages/artplayer/package.json b/packages/artplayer/package.json index 03a58108b..42b7509d6 100644 --- a/packages/artplayer/package.json +++ b/packages/artplayer/package.json @@ -1,6 +1,6 @@ { "name": "artplayer", - "version": "4.2.2", + "version": "4.2.3", "expose": "Artplayer", "description": "ArtPlayer.js is a modern and full featured HTML5 video player", "main": "dist/artplayer.js",