From 0acc2482d5ab0cacaf6750fbcaeddc8bc91f736e Mon Sep 17 00:00:00 2001 From: Harvey Date: Thu, 28 Nov 2019 13:33:28 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E5=A4=9A=E4=BD=99=E7=A9=BA?= =?UTF-8?q?=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .size-snapshot.json | 6 +++--- dist/artplayer.js | 2 +- packages/artplayer/dist/artplayer.js | 2 +- packages/artplayer/src/contextmenu/aspectRatio.js | 3 +-- packages/artplayer/src/contextmenu/playbackRate.js | 3 +-- packages/artplayer/src/i18n/zh-cn.json | 1 - packages/artplayer/src/i18n/zh-tw.json | 1 - 7 files changed, 7 insertions(+), 11 deletions(-) diff --git a/.size-snapshot.json b/.size-snapshot.json index f0f7bafe0..0a55de944 100644 --- a/.size-snapshot.json +++ b/.size-snapshot.json @@ -1,8 +1,8 @@ { "packages/artplayer/dist/artplayer.js": { - "bundled": 156998, - "minified": 84282, - "gzipped": 20995 + "bundled": 156908, + "minified": 84202, + "gzipped": 20952 }, "packages/artplayer-plugin-backlight/dist/artplayer-plugin-backlight.js": { "bundled": 4642, diff --git a/dist/artplayer.js b/dist/artplayer.js index cc672bbce..f35b55983 100644 --- a/dist/artplayer.js +++ b/dist/artplayer.js @@ -5,4 +5,4 @@ * 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=t||self).Artplayer=e()}(this,(function(){"use strict";var t=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function e(t,e){for(var n=0;n1?n-1:0),i=1;i1&&void 0!==arguments[1]?arguments[1]:document).querySelector(t)}function d(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(e.querySelectorAll(t))}function h(t,e){return t.classList.add(e)}function y(t,e){return t.classList.remove(e)}function v(t,e){return t.classList.contains(e)}function m(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function g(t,e,n){return t.style[e]=n,t}function b(t,e){return Object.keys(e).forEach((function(n){g(t,n,e[n])})),t}function w(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=window.getComputedStyle(t,null).getPropertyValue(e);return n?parseFloat(r):r}function O(t){return Array.from(t.parentElement.children).filter((function(e){return e!==t}))}function j(t,e){O(t).forEach((function(t){return y(t,e)})),h(t,e)}function x(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"up";t.setAttribute("aria-label",e),t.setAttribute("data-balloon-pos",n)}var k=function(t){return-1!==Function.toString.call(t).indexOf("[native code]")},P=r((function(t){function e(n,r,i){return!function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}()?t.exports=e=function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&u(i,n.prototype),i}:t.exports=e=Reflect.construct,e.apply(null,arguments)}t.exports=e})),S=function(e){function n(e,r){var i;return t(this,n),i=a(this,c(n).call(this,e)),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(o(i),r||i.constructor),i.name="ArtPlayerError",i}return s(n,e),n}(r((function(t){function e(n){var r="function"==typeof Map?new Map:void 0;return t.exports=e=function(t){if(null===t||!k(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,e)}function e(){return P(t,arguments,c(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),u(e,t)},e(n)}t.exports=e}))(Error));function E(t,e){if(!t)throw new S(e);return t}function $(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 R(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function C(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 n(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(/[:.]/).map((function(t,e,n){if(e===n.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===n.length-1?".".concat(t):":".concat(t)})).join("")}return"WEBVTT\n\n".concat(t.split(/\r?\n/).map((function(t){var r=t.match(e);return r?{start:n(r[1].trim()),end:n(r[2].trim()),text:r[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 D(t){return t.includes("?")?D(t.split("?")[0]):t.includes("#")?D(t.split("#")[0]):t.trim().toLowerCase().split(".").pop()}function T(t,e){var n=document.createElement("a");n.style.display="none",n.href=t,n.download=e,document.body.appendChild(n),n.click(),document.body.removeChild(n)}var L=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e1?e-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(e){return setTimeout(e,t)}))}function N(t,e,n){var r;function i(){for(var i=arguments.length,o=new Array(i),a=0;a0?[e,n,r]:[n,r]).map((function(t){return t<10?"0".concat(t):String(t)})).join(":")}var X=Object.freeze({__proto__:null,query:p,queryAll:d,addClass:h,removeClass:y,hasClass:v,append:m,remove:function(t){return t.parentNode.removeChild(t)},setStyle:g,setStyles:b,getStyle:w,sublings:O,inverseClass:j,tooltip:x,ArtPlayerError:S,errorHandle:E,srtToVtt:$,vttToBlob:R,assToVtt:C,getExt:D,downloadFile:T,def:z,has:V,proxyPropertys:F,mergeDeep:H,sleep:B,debounce:N,throttle:I,clamp:U,secondToTime:_});function Z(t,e,n){return E("string"===e||t instanceof Element,"".concat(n.join(".")," require 'string' or 'Element' type"))}var Y={container:Z,url:"string",poster:"string",title:"string",theme:"string",lang:"string",volume:"number",isLive:"boolean",muted:"boolean",autoplay:"boolean",autoSize:"boolean",loop:"boolean",flip:"boolean",playbackRate:"boolean",aspectRatio:"boolean",screenshot:"boolean",setting:"boolean",hotkey:"boolean",pip:"boolean",mutex:"boolean",fullscreen:"boolean",fullscreenWeb:"boolean",subtitleOffset:"boolean",miniProgressBar:"boolean",localVideo:"boolean",localSubtitle:"boolean",networkMonitor:"boolean",plugins:["function"],whitelist:["string|function|regexp"],layers:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:Z,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined"}],contextmenu:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:Z,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined"}],quality:[{default:"boolean|undefined",name:"string",url:"string"}],controls:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:Z,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined",position:function(t,e,n){var r=["top","left","right"];return E(r.includes(t),"".concat(n.join(".")," only accept ").concat(r.toString()," as parameters"))}}],highlight:[{time:"number",text:"string"}],thumbnails:{url:"string",number:"number",width:"number",height:"number",column:"number"},subtitle:{url:"string",style:"object"},moreVideoAttr:"object",icons:"object",customType:"object"},J={propertys:["audioTracks","autoplay","buffered","controller","controls","crossOrigin","currentSrc","currentTime","defaultMuted","defaultPlaybackRate","duration","ended","error","loop","mediaGroup","muted","networkState","paused","playbackRate","played","preload","readyState","seekable","seeking","src","startDate","textTracks","videoTracks","volume"],methods:["addTextTrack","canPlayType","load","play","pause"],events:["abort","canplay","canplaythrough","durationchange","emptied","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"]},G=function e(n){var r=this;t(this,e);var i=n.constructor.kindOf,o=n.option.whitelist;this.ua=navigator.userAgent,this.isMobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(this.ua),this.state=!this.isMobile||o.some((function(t){switch(i(t)){case"string":return r.ua.indexOf(t)>-1;case"function":return t(r.ua);case"regexp":return t.test(r.ua);default:return!1}}))},Q=function(){function e(n){var r=this;t(this,e),this.art=n,n.option.container instanceof Element?this.$container=n.option.container:(this.$container=p(n.option.container),E(this.$container,"No container element found by ".concat(n.option.container))),E(n.constructor.instances.every((function(t){return t.template.$container!==r.$container})),"Cannot mount multiple instances on the same dom element"),E(this.$container.clientWidth&&this.$container.clientHeight,"The width and height of the container cannot be 0"),n.whitelist.state?this.desktop():this.mobile()}return n(e,[{key:"query",value:function(t){return p(t,this.$container)}},{key:"desktop",value:function(){this.$container.innerHTML='
Player version:
3.2.5
Video url:
Video volume:
Video time:
Video duration:
Video resolution:
x
[x]
xD7
'),this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video"),this.$track=this.query(".art-video track"),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.$pipHeader=this.query(".art-pip-header"),this.$pipTitle=this.query(".art-pip-title"),this.$pipClose=this.query(".art-pip-close"),this.$contextmenu=this.query(".art-contextmenus")}},{key:"mobile",value:function(){this.$container.innerHTML='
',this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video")}},{key:"destroy",value:function(t){t?this.$container.innerHTML="":h(this.$player,"art-destroy")}}]),e}(),K={"About author":"关于作者","Video info":"视频统计信息",Close:"关闭","Video load failed":"视频加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音",Flip:"视频翻转",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":"迷你播放器","Exit mini player":"退出迷你播放器","Local Subtitle":"本地字幕","Local Video":"本地视频","Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},tt={"About author":"關於作者","Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"影片翻轉",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":"迷你播放器","Exit mini player":"退出迷你播放器","Local Subtitle":"本地字幕","Local Video":"本地視頻","Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"},et=function(){function e(n){t(this,e),this.art=n,this.languages={"zh-cn":K,"zh-tw":tt},this.init()}return n(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=H(this.languages,t),this.init()}}]),e}();var nt=r((function(t){!function(){var e="undefined"!=typeof window&&void 0!==window.document?window.document:{},n=t.exports,r=function(){for(var t,n=[["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"]],r=0,i=n.length,o={};rh){var y=h*l/s;g(r,"width","".concat(100*y,"%")),g(r,"height","100%"),g(r,"padding","0 ".concat((f-f*y)/2,"px"))}else{var v=s/h/l;g(r,"width","100%"),g(r,"height","".concat(100*v,"%")),g(r,"padding","".concat((p-p*v)/2,"px 0"))}}i.dataset.aspectRatio=n,a.show="".concat(o.get("Aspect ratio"),": ").concat("default"===n?o.get("Default"):n),t.emit("aspectRatioChange",n)}else e.aspectRatio&&(g(r,"width",null),g(r,"height",null),g(r,"padding",null),delete i.dataset.aspectRatio,t.emit("aspectRatioRemove"))}}),z(e,"aspectRatioReset",{set:function(n){if(n&&e.aspectRatio){var r=e.aspectRatio;e.aspectRatio=r,t.emit("aspectRatioReset")}}})}(n,this),function(t,e){var n=t.option,r=t.notice,i=t.template.$video;z(e,"getScreenshotDataURL",{value:function(){try{var t=document.createElement("canvas");return t.width=i.videoWidth,t.height=i.videoHeight,t.getContext("2d").drawImage(i,0,0),t.toDataURL("image/png")}catch(t){throw r.show=t,t}}}),z(e,"getScreenshotBlobUrl",{value:function(){return new Promise((function(t,e){try{var n=document.createElement("canvas");n.width=i.videoWidth,n.height=i.videoHeight,n.getContext("2d").drawImage(i,0,0),n.toBlob((function(e){t(URL.createObjectURL(e))}))}catch(t){r.show=t,e(t)}}))}}),z(e,"screenshot",{value:function(){var r=e.getScreenshotDataURL();r&&(T(r,"".concat(n.title||"artplayer","_").concat(_(i.currentTime),".png")),t.emit("screenshot",r))}})}(n,this),function(t,e){var n=t.template.$player;z(e,"fullscreen",{get:function(){return nt.isFullscreen},set:function(r){e.fullscreenWeb&&(e.fullscreenWeb=!1),r?nt.request(n).then((function(){h(n,"art-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenChange",!0)})):nt.exit().then((function(){y(n,"art-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenChange",!1)}))}}),z(e,"fullscreenToggle",{set:function(t){t&&(e.fullscreen=!e.fullscreen)}})}(n,this),function(t,e){var n=t.template.$player;z(e,"fullscreenWeb",{get:function(){return v(n,"art-web-fullscreen")},set:function(r){e.fullscreen&&(e.fullscreen=!1),r?(h(n,"art-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWebChange",!0)):(y(n,"art-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWebChange",!1))}}),z(e,"fullscreenWebToggle",{set:function(t){t&&(e.fullscreenWeb=!e.fullscreenWeb)}})}(n,this),rt(n,this),function(t,e){var n=t.template.$video;z(e,"loaded",{get:function(){return e.loadedTime/n.duration}}),z(e,"loadedTime",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1):0}})}(n,this),function(t,e){z(e,"played",{get:function(){return e.currentTime/e.duration}})}(0,this),function(t,e){var n=t.template.$video;z(e,"playing",{get:function(){return!!(n.currentTime>0&&!n.paused&&!n.ended&&n.readyState>2)}})}(n,this),function(t,e){var n=t.template,r=n.$container,i=n.$player,o=n.$video;z(e,"autoSize",{get:function(){return v(r,"art-auto-size")},set:function(n){if(n){var a=o.videoWidth,c=o.videoHeight,u=r.getBoundingClientRect(),s=u.width,l=u.height,f=a/c,p=s/l;if(h(r,"art-auto-size"),p>f){g(i,"width","".concat(l*f/s*100,"%")),g(i,"height","100%")}else{var d=s/f/l*100;g(i,"width","100%"),g(i,"height","".concat(d,"%"))}t.emit("autoSizeChange",{width:e.width,height:e.height})}else y(r,"art-auto-size"),g(i,"width",null),g(i,"height",null),t.emit("autoSizeRemove")}})}(n,this),function(t,e){z(e,"rect",{get:function(){return t.template.$player.getBoundingClientRect()}}),["bottom","height","left","right","top","width"].forEach((function(t){z(e,t,{get:function(){return e.rect[t]}})})),z(e,"x",{get:function(){return e.left+window.pageXOffset}}),z(e,"y",{get:function(){return e.top+window.pageYOffset}})}(n,this),function(t,e){var n=t.template.$player;z(e,"flip",{get:function(){return n.dataset.flip},set:function(e){if(e){var r=["normal","horizontal","vertical"];E(r.includes(e),"'flip' only accept ".concat(r.toString()," as parameters")),n.dataset.flip=e,t.emit("flipChange",e)}else delete n.dataset.flip,t.emit("flipRemove")}})}(n,this),F(n,this)};var ot=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=c(t)););return t},at=r((function(t){function e(n,r,i){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=e=Reflect.get:t.exports=e=function(t,e,n){var r=ot(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}},e(n,r,i||n)}t.exports=e})),ct=function(){function e(n){t(this,e),this.id=0,this.art=n,this.add=this.add.bind(this),this.name=this.constructor.name.toLowerCase()}return n(e,[{key:"add",value:function(t,e){var n=this,r="function"==typeof t?t(this.art):t;if(this.$parent&&!r.disable){this.id+=1;var i=r.name||"".concat(this.name).concat(this.id),o=document.createElement("div");o.classList.value="art-".concat(this.name," art-").concat(this.name,"-").concat(i),r.html&&m(o,r.html),r.style&&b(o,r.style),r.tooltip&&x(o,r.tooltip);var a=Array.from(this.$parent.children);o.dataset.index=r.index||this.id;var c=a.find((function(t){return Number(t.dataset.index)>=Number(o.dataset.index)}));c?c.insertAdjacentElement("beforebegin",o):m(this.$parent,o),r.click&&this.art.events.proxy(o,"click",(function(t){t.preventDefault(),r.click.call(n.art,n,t)})),r.mounted&&r.mounted(o,this,this.art),e&&e(o,this,this.art),this.art.emit("".concat(this.name,":add"),r)}}},{key:"show",get:function(){return v(this.art.template.$player,"art-".concat(this.name,"-show"))},set:function(t){var e=this.art.template.$player,n="art-".concat(this.name,"-show");t?h(e,n):y(e,n),this.art.emit("".concat(this.name,":toggle"),t)}},{key:"toggle",set:function(t){t&&(this.show=!this.show)}}]),e}();var ut=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};function st(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function lt(t){return function(e){return function(t){for(var e=1;e
'),mounted:function(t){var n=!1,i=p(".art-progress-loaded",t),c=p(".art-progress-played",t),u=p(".art-progress-highlight",t),s=p(".art-progress-indicator",t),l=p(".art-progress-tip",t);function f(t,e){"loaded"===t&&g(i,"width","".concat(100*e,"%")),"played"===t&&(g(c,"width","".concat(100*e,"%")),g(s,"left","calc(".concat(100*e,"% - ").concat(w(s,"width")/2,"px)")))}r.forEach((function(t){var e=U(t.time,0,a.duration)/a.duration*100;m(u,''))})),f("loaded",a.loaded),e.on("video:progress",(function(){f("loaded",a.loaded)})),e.on("video:timeupdate",(function(){f("played",a.played)})),e.on("video:ended",(function(){f("played",1)})),o(t,"mousemove",(function(n){g(l,"display","block"),n.composedPath().indexOf(u)>-1?function(n){var r=gt(e,n).width,i=n.target.dataset.text;l.innerHTML=i;var o=l.clientWidth;r<=o/2?g(l,"left",0):r>t.clientWidth-o/2?g(l,"left","".concat(t.clientWidth-o,"px")):g(l,"left","".concat(r-o/2,"px"))}(n):function(n){var r=gt(e,n),i=r.width,o=r.time;l.innerHTML=o;var a=l.clientWidth;i<=a/2?g(l,"left",0):i>t.clientWidth-a/2?g(l,"left","".concat(t.clientWidth-a,"px")):g(l,"left","".concat(i-a/2,"px"))}(n)})),o(t,"mouseout",(function(){g(l,"display","none")})),o(t,"click",(function(t){if(t.target!==s){var n=gt(e,t),r=n.second;f("played",n.percentage),a.seek=r}})),o(s,"mousedown",(function(){n=!0})),o(document,"mousemove",(function(t){if(n){var r=gt(e,t),i=r.second,o=r.percentage;h(s,"art-show-indicator"),f("played",o),a.seek=i}})),o(document,"mouseup",(function(){n&&(n=!1,y(s,"art-show-indicator"))}))}})}}function wt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ot(t){return function(e){return function(t){for(var e=1;e'),l=m(s,'
');function f(t){var e=s.getBoundingClientRect(),n=e.left,r=e.width,i=l.getBoundingClientRect().width;return U(t.pageX-n-i/2,0,r-i/2)/(r-i)}function p(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.7;if(i.muted||0===t)g(c,"display","none"),g(u,"display","flex"),g(l,"left","0");else{var e=((w(s,"width")||60)-w(l,"width"))*t;g(c,"display","flex"),g(u,"display","none"),g(l,"left","".concat(e,"px"))}}x(c,o.get("Mute")),g(u,"display","none"),p(i.volume),e.on("video:volumechange",(function(){p(i.volume)})),n(c,"click",(function(){i.muted=!0})),n(u,"click",(function(){i.muted=!1})),n(s,"click",(function(t){i.muted=!1,i.volume=f(t)})),n(l,"mousedown",(function(){a=!0})),n(document,"mousemove",(function(t){a&&(i.muted=!1,i.volume=f(t))})),n(document,"mouseup",(function(){a&&(a=!1)}))}})}}function St(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Et(t){return function(e){return function(t){for(var e=1;er.clientWidth-u/2?g(t,"left","".concat(r.clientWidth-u,"px")):g(t,"left","".concat(o-u/2,"px"))}(i))})),o(r,"mouseout",(function(){g(t,"display","none")}))}})}}function Ct(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Dt(t){return function(e){return function(t){for(var e=1;e'.concat(u.name,"")),l=n.map((function(t,e){return'
').concat(t.name,"
")})).join(""),f=m(t,'
'.concat(l,"
"));o(t,(function(){f.style.left="-".concat(w(f,"width")/2-t.clientWidth/2,"px")})),i(f,"click",(function(t){var e=Number(t.target.dataset.index),r=n[e],i=r.url,o=r.name;i&&o&&c!==e&&(a.switchQuality(i,o),s.innerText=o,c=e)}))}})}}var At=function(e){function r(e){var n;t(this,r),n=a(this,c(r).call(this,e));var i=e.option;return e.on("ready",(function(){n.add(bt({name:"progress",disable:i.isLive,position:"top",index:10})),n.add(Rt({name:"thumbnails",disable:!i.thumbnails.url||i.isLive,position:"top",index:20})),n.add(vt({name:"playAndPause",disable:!1,position:"left",index:10})),n.add(Pt({name:"volume",disable:!1,position:"left",index:20})),n.add(xt({name:"time",disable:i.isLive,position:"left",index:30})),n.add(Lt({name:"quality",disable:0===i.quality.length,position:"right",index:10})),n.add(Dt({name:"screenshot",disable:!i.screenshot,position:"right",index:20})),n.add(Ot({name:"subtitle",disable:!i.subtitle.url,position:"right",index:30})),n.add(Et({name:"setting",disable:!i.setting,position:"right",index:40})),n.add(ht({name:"pip",disable:!i.pip,position:"right",index:50})),n.add(pt({name:"fullscreenWeb",disable:!i.fullscreenWeb,position:"right",index:60})),n.add(lt({name:"fullscreen",disable:!i.fullscreen,position:"right",index:70})),i.controls.forEach((function(t){n.add(t)}))})),n}return s(r,e),n(r,[{key:"add",value:function(t,e){var n=this,i="function"==typeof t?t(this.art):t;E(["top","left","right"].includes(i.position),"Control option.position must one of 'top', 'left', 'right'");var o=this.art.template,a=o.$progress,u=o.$controlsLeft,s=o.$controlsRight;switch(i.position){case"top":this.$parent=a;break;case"left":this.$parent=u;break;case"right":this.$parent=s}at(c(r.prototype),"add",this).call(this,i,(function(t){i.disable||"top"===i.position||t.firstElementChild&&"I"===t.firstElementChild.tagName||h(t,"art-control-onlyText"),e&&e(t,n,n.art)}))}}]),r}(ct);function Mt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function qt(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e0.50.75').concat(n.get("Normal"),'1.251.52.0'),click:function(t,e){var n=e.target.dataset.rate;n&&(r.playbackRate=Number(n),t.show=!1)},mounted:function(t){e.on("playbackRateChange",(function(e){var n=d("span",t).find((function(t){return Number(t.dataset.rate)===e}));n&&j(n,"art-current")}))}})}}function zt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Wt(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e').concat(n.get("Default"),'4:316:9'),click:function(t,e){var n=e.target.dataset.ratio;n&&(r.aspectRatio=n,t.show=!1)},mounted:function(t){e.on("aspectRatioChange",(function(e){var n=d("span",t).find((function(t){return t.dataset.ratio===e}));n&&j(n,"art-current")}))}})}}function Vt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ft(t){return function(e){return function(t){for(var e=1;eArtPlayer 3.2.5'})}function Nt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function It(t){return function(e){return function(t){for(var e=1;ec+a&&(h=a-d),n+p>l+o&&(y=o-p),b(s,{top:"".concat(y,"px"),left:"".concat(h,"px")})})),l(u,"click",(function(t){t.composedPath().includes(s)||(r.show=!1)})),e.on("blur",(function(){r.show=!1}))})),r}return s(n,e),n}(ct),_t=function(e){function n(e){var r;t(this,n),r=a(this,c(n).call(this,e));var i=e.template,o=i.$infoPanel,u=i.$infoClose,s=i.$video;(0,e.events.proxy)(u,"click",(function(){r.show=!1}));var l=null,f=d("[data-video]",o);return e.on("destroy",(function(){clearTimeout(l)})),e.on("info:toggle",(function(t){clearTimeout(l),t&&function t(){f.forEach((function(t){var e=s[t.dataset.video];t.innerText="number"==typeof e?e.toFixed(2):e})),l=setTimeout((function(){t()}),1e3)}()})),r}return s(n,e),n}(ct),Xt=function(e){function r(e){var n;t(this,r),n=a(this,c(r).call(this,e));var i=e.events.proxy,u=e.option.subtitle;return b(e.template.$subtitle,u.style),i(n.textTrack,"cuechange",n.update.bind(o(n))),u.url&&n.init(u.url),n}return s(r,e),n(r,[{key:"update",value:function(){var t=this.art.template.$subtitle;t.innerHTML="",this.activeCue&&(t.innerHTML=this.activeCue.text.split(/\r?\n/).map((function(t){return"

".concat(t,"

")})).join(""),this.art.emit("subtitle:update",this.activeCue.text))}},{key:"switch",value:function(t,e,n){var r=this,i=this.art,o=i.i18n,a=i.notice;return this.init(t,n).then((function(t){return e&&(a.show="".concat(o.get("Switch subtitle"),": ").concat(e)),r.art.emit("subtitle:switch",t),t}))}},{key:"init",value:function(t,e){var n=this,r=this.art,i=r.notice,o=r.template,a=o.$subtitle,c=o.$track;return fetch(t).then((function(t){return t.text()})).then((function(r){switch(n.art.emit("subtitle:load",t),e||D(t)){case"srt":return R($(r));case"ass":return R(C(r));case"vtt":return R(r);default:return t}})).then((function(t){return a.innerHTML="",n.url===t?t:(URL.revokeObjectURL(n.url),c.src=t,t)})).catch((function(t){throw i.show=t,n.art.emit("subtitle:err",t),t}))}},{key:"url",get:function(){return this.art.template.$track.src}},{key:"textTrack",get:function(){return this.art.template.$video.textTracks[0]}},{key:"activeCue",get:function(){return this.textTrack.activeCues[0]}}]),r}(ct);var Zt=function(){function e(n){var r=this;t(this,e),this.destroyEvents=[],this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),this.loadImg=this.loadImg.bind(this),n.whitelist.state&&n.on("ready",(function(){!function(t,e){var n=t.template.$player;e.proxy(document,["click","contextmenu"],(function(e){e.composedPath().indexOf(n)>-1?(t.isFocus=!0,t.emit("focus")):(t.isFocus=!1,t.emit("blur"))}))}(n,r),function(t,e){var n=t.template.$player;e.hover(n,(function(){h(n,"art-hover"),t.emit("hoverenter")}),(function(){y(n,"art-hover"),t.emit("hoverleave")}))}(n,r),function(t,e){var n=t.template,r=n.$player,i=n.$video,o=t.player,a=t.controls,c=N((function(){h(r,"art-hide-cursor"),y(r,"art-hover"),a.show=!1}),3e3);t.on("hoverleave",(function(){o.playing&&c()})),e.proxy(r,"mousemove",(function(e){c.clearTimeout(),y(r,"art-hide-cursor"),a.show=!0,!o.pip&&o.playing&&e.target===i&&c(),t.emit("mousemove")}))}(n,r),function(t,e){var n=t.option,r=t.player,i=t.template.$player,o=document.createElement("object");o.setAttribute("aria-hidden","true"),o.setAttribute("tabindex",-1),o.type="text/html",o.data="about:blank";var a=r.width,c=r.height,u=I((function(){r.width===a&&r.height===c||(a=r.width,c=r.height,n.autoSize&&(r.fullscreen||r.fullscreenWeb||r.pip?r.autoSize=!1:r.autoSize=!0),r.aspectRatioReset=!0,t.emit("resize",{width:r.width,height:r.height}))}),500);e.proxy(o,"load",(function(){e.proxy(o.contentDocument.defaultView,"resize",u)})),i.appendChild(o)}(n,r)}))}return n(e,[{key:"proxy",value:function(t,e,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(Array.isArray(e))return e.map((function(e){return r.proxy(t,e,n,i)}));t.addEventListener(e,n,i);var o=function(){return t.removeEventListener(e,n,i)};return this.destroyEvents.push(o),o}},{key:"hover",value:function(t,e,n){e&&this.proxy(t,"mouseenter",e),n&&this.proxy(t,"mouseleave",n)}},{key:"loadImg",value:function(t){var e=this;return new Promise((function(n,r){var i;if(t instanceof HTMLImageElement)i=t;else{if("string"!=typeof t)return r(t);(i=new Image).src=t}return i.complete?n(i):(e.proxy(i,"load",(function(){return n(i)})),e.proxy(i,"error",(function(){return r(i)})),t)}))}},{key:"destroy",value:function(){this.destroyEvents.forEach((function(t){return t()}))}}]),e}(),Yt=function(){function e(n){var r=this;t(this,e),this.keys={};var i=n.option,o=n.player,a=n.events.proxy;i.hotkey&&n.on("ready",(function(){r.add(27,(function(){o.fullscreenWeb&&(o.fullscreenWeb=!1)})),r.add(32,(function(){o.toggle=!0})),r.add(37,(function(){o.seek=o.currentTime-5})),r.add(38,(function(){o.volume+=.1})),r.add(39,(function(){o.seek=o.currentTime+5})),r.add(40,(function(){o.volume-=.1})),a(window,"keydown",(function(t){if(n.isFocus){var e=document.activeElement.tagName.toUpperCase(),i=document.activeElement.getAttribute("contenteditable");if("INPUT"!==e&&"TEXTAREA"!==e&&""!==i&&"true"!==i){var o=r.keys[t.keyCode];o&&(t.preventDefault(),o.forEach((function(t){return t()})),n.emit("hotkey",t))}}}))}))}return n(e,[{key:"add",value:function(t,e){this.keys[t]?this.keys[t].push(e):this.keys[t]=[e]}}]),e}(),Jt=function(e){function n(e){var r;return t(this,n),(r=a(this,c(n).call(this,e))).$parent=e.template.$layer,e.on("ready",(function(){e.option.layers.forEach((function(t){r.add(t)}))})),r}return s(n,e),n}(ct),Gt=function(e){function n(e){var r;return t(this,n),r=a(this,c(n).call(this,e)),m(e.template.$loading,e.icons.loading),r}return s(n,e),n}(ct),Qt=function(){function e(n){t(this,e),this.art=n,this.time=2e3,this.timer=null}return n(e,[{key:"show",set:function(t){var e=this.art.template,n=e.$player,r=e.$noticeInner;r.innerText=t instanceof Error?t.message.trim():t,h(n,"art-notice-show"),clearTimeout(this.timer),this.timer=setTimeout((function(){r.innerText="",y(n,"art-notice-show")}),this.time)}}]),e}(),Kt=function(e){function n(e){var r;return t(this,n),r=a(this,c(n).call(this,e)),m(e.template.$state,e.icons.state),r}return s(n,e),n}(ct);function te(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}var ee=function e(n){var r=this;t(this,e);var i=function(t){for(var e=1;e',state:'',play:'',pause:'',volume:'',volumeClose:'',subtitle:'',screenshot:'\t',setting:'',fullscreen:'\t\t\t\t',fullscreenWeb:'\t',pip:''},n.option.icons);Object.keys(i).forEach((function(t){var e=document.createElement("i");e.classList.add("art-icon"),e.classList.add("art-icon-".concat(t)),m(e,i[t]),r[t]=e}))};function ne(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function re(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e'.concat(n.get("Flip"),'
"),click:function(t,e){var n=e.target.dataset.value;n&&(r.flip=n)},mounted:function(t){e.on("flipChange",(function(e){var n=d("button",t).find((function(t){return t.dataset.value===e}));n&&j(n.parentElement,"current")}))}})}}function ie(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function oe(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e'.concat(n.get("Aspect ratio"),'
'),click:function(t,e){var n=e.target.dataset.value;n&&(r.aspectRatio=n)},mounted:function(t){e.on("aspectRatioChange",(function(e){var n=d("button",t).find((function(t){return t.dataset.value===e}));n&&j(n.parentElement,"current")}))}})}}function ae(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function ce(t){return function(e){var n=e.i18n,r=e.player,i=e.events.proxy;return function(t){for(var e=1;e'.concat(n.get("Play speed"),': 1.0x
'),mounted:function(t){var n=p(".art-setting-range input",t),o=p(".art-subtitle-value",t);i(n,"change",(function(){var t=n.value;o.innerText=t,r.playbackRate=Number(t)})),e.on("playbackRateChange",(function(t){n.value!==t&&(n.value=t,o.innerText=t)}))}})}}var ue=function(e){function n(e){var r;t(this,n),r=a(this,c(n).call(this,e));var i=e.option,o=e.template,u=o.$setting,s=o.$settingBody,l=e.events.proxy;return r.$parent=s,i.setting&&(e.on("ready",(function(){l(u,"click",(function(t){t.target===u&&(r.show=!1)})),r.add(re({disable:!i.flip,name:"flip"})),r.add(oe({disable:!i.aspectRatio,name:"aspectRatio"})),r.add(ce({disable:!i.playbackRate,name:"playbackRate"}))})),e.on("blur",(function(){r.show=!1}))),r}return s(n,e),n}(ct),se=function(){function e(){t(this,e),this.name="artplayer_settings"}return n(e,[{key:"get",value:function(t){var e=JSON.parse(localStorage.getItem(this.name))||{};return t?e[t]:{}}},{key:"set",value:function(t,e){var n=Object.assign({},this.get(),ut({},t,e));localStorage.setItem(this.name,JSON.stringify(n))}},{key:"del",value:function(t){var e=this.get();delete e[t],localStorage.setItem(this.name,JSON.stringify(e))}},{key:"clean",value:function(){localStorage.removeItem(this.name)}}]),e}();function le(t){var e=t.i18n,n=t.subtitle,r=t.events.proxy;return{title:"Subtitle",name:"subtitleOffset",index:20,html:'
'.concat(e.get("Subtitle offset time"),': 0s
'),mounted:function(e){var i=p(".art-setting-range input",e),o=p(".art-subtitle-value",e);r(i,"change",(function(){var e=i.value;o.innerText=e,t.plugins.subtitleOffset.offset(Number(e))})),t.on("subtitle:switch",(function(){i.value=0,o.innerText=0})),t.on("subtitleOffset",(function(t){n.update(),i.value!==t&&(i.value=t,o.innerText=t)}))}}}function fe(t){var e=t.constructor.utils.clamp,n=t.setting,r=t.notice,i=t.template,o=t.i18n,a=t.player;n.add(le);var c=[];return t.on("subtitle:switch",(function(){c=[]})),{name:"subtitleOffset",offset:function(n){if(i.$track&&i.$track.track){var u=Array.from(i.$track.track.cues),s=e(n,-5,5);u.forEach((function(t,n){c[n]||(c[n]={startTime:t.startTime,endTime:t.endTime}),t.startTime=e(c[n].startTime+s,0,a.duration),t.endTime=e(c[n].endTime+s,0,a.duration)})),r.show="".concat(o.get("Subtitle offset time"),": ").concat(n,"s"),t.emit("subtitleOffset",n)}else r.show="".concat(o.get("No subtitles found")),t.emit("subtitleOffset",0)}}}function pe(t){var e=t.events.proxy,n=t.template,r=t.player,i=t.option,o=t.setting,a=t.i18n;function c(e){if(e){var o=n.$video.canPlayType(e.type);if("maybe"===o||"probably"===o){var a=URL.createObjectURL(e);i.title=e.name,r.switchUrl(a,e.name),t.emit("localVideo",e)}else E(!1,"Playback of this file format is not supported")}}function u(t){var n=m(t,'');g(t,"position","relative"),b(n,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(n,"change",(function(){c(n.files[0])}))}return e(n.$player,"dragover",(function(t){t.preventDefault()})),e(n.$player,"drop",(function(t){t.preventDefault(),c(t.dataTransfer.files[0])})),t.on("ready",(function(){o.add({title:"Local Video",name:"localVideo",index:30,html:'
'.concat(a.get("Local Video"),'
').concat(a.get("Open"),'
'),mounted:function(e){var n=p(".art-upload-btn",e),r=p(".art-upload-value",e);t.on("localVideo",(function(t){r.textContent=t.name,r.title=t.name})),u(n)}})})),{name:"localVideo",attach:u}}function de(t){var e=t.events.proxy,n=t.subtitle,r=t.setting,i=t.i18n;function o(r){var i=m(r,'');g(r,"position","relative"),b(i,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(i,"change",(function(){!function(e){if(e){var r=D(e.name);if(["ass","vtt","srt"].includes(r)){var i=URL.createObjectURL(e);n.switch(i,e.name,r),t.emit("localSubtitle",e)}else E(!1,"Only supports subtitle files in .ass, .vtt and .srt format")}}(i.files[0])}))}return t.on("ready",(function(){r.add({title:"Local Subtitle",name:"localSubtitle",index:40,html:'
'.concat(i.get("Local Subtitle"),'
').concat(i.get("Open"),'
'),mounted:function(e){var n=p(".art-upload-btn",e),r=p(".art-upload-value",e);t.on("localSubtitle",(function(t){r.textContent=t.name,r.title=t.name})),o(n)}})})),{name:"localSubtitle",attach:o}}function he(t){var e=t.layers,n=t.player,r=t.option.theme;return e.add({name:"miniProgressBar",style:{display:"none",position:"absolute",left:0,right:0,bottom:0,height:"2px",background:r},mounted:function(e){t.on("control:toggle",(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*n.played,"%")}))}}),{name:"miniProgressBar"}}function ye(t){var e=1e4,n=0,r=0,i=0,o=null;function a(){n=0,r=0,i=0,cancelAnimationFrame(o),o=null}function c(){o||function a(){t.isDestroy||(o=requestAnimationFrame((function(){var o=Date.now();if(i){var c=o-i;r+=c,t.player.playing||(n+=c)}i=o,t.emit("networkMonitor",n/r),r>=e&&(n=0,r=0),a()})))}()}return t.on("play",c),t.on("pause",a),{name:"networkMonitor",reset:a,start:c,sample:function(t){e=t}}}var ve=function(){function e(n){var r=this;t(this,e),this.art=n,this.id=0;var i=n.option;i.subtitle.url&&i.subtitleOffset&&this.add(fe),!i.isLive&&i.miniProgressBar&&this.add(he),i.localVideo&&this.add(pe),i.localSubtitle&&this.add(de),i.networkMonitor&&this.add(ye),n.option.plugins.forEach((function(t){r.add(t)}))}return n(e,[{key:"add",value:function(t){this.id+=1;var e=t.call(this,this.art),n="";return E(!V(this,n=e&&e.name?e.name:t.name?t.name:"plugin".concat(this.id)),"Cannot add a plugin that already has the same name: ".concat(n)),Object.defineProperty(this,n,{value:e}),this.art.emit("plugin:add",t),this}}]),e}(),me=function e(n){t(this,e);var r=n.option,i=n.events.proxy,o=n.template.$video;J.events.forEach((function(t){i(o,t,(function(t){n.emit("video:".concat(t.type),t)}))})),Object.keys(r.moreVideoAttr).forEach((function(t){o[t]=r.moreVideoAttr[t]})),r.muted&&(o.muted=r.muted),r.volume&&(o.volume=U(r.volume,0,1)),r.poster&&(o.poster=r.poster),r.autoplay&&(o.autoplay=r.autoplay),o.controls=!0;var a=r.type||D(r.url),c=r.customType[a];a&&c?(c(o,r.url,n),n.emit("customType",a)):(o.src=r.url,n.emit("urlChange",o.src))},ge=0,be=function(e){function r(e){var n;return t(this,r),(n=a(this,c(r).call(this))).option=l(H(r.option,e),Y),n.isFocus=!1,n.isDestroy=!1,n.whitelist=new G(o(n)),n.template=new Q(o(n)),n.events=new Zt(o(n)),n.whitelist.state?(n.storage=new se(o(n)),n.icons=new ee(o(n)),n.i18n=new et(o(n)),n.notice=new Qt(o(n)),n.player=new it(o(n)),n.layers=new Jt(o(n)),n.controls=new At(o(n)),n.contextmenu=new Ut(o(n)),n.subtitle=new Xt(o(n)),n.info=new _t(o(n)),n.loading=new Gt(o(n)),n.hotkey=new Yt(o(n)),n.mask=new Kt(o(n)),n.setting=new ue(o(n)),n.plugins=new ve(o(n))):n.mobile=new me(o(n)),ge+=1,n.id=ge,r.instances.push(o(n)),n}return s(r,e),n(r,[{key:"destroy",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.events.destroy(),this.template.destroy(t),r.instances.splice(r.instances.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}],[{key:"version",get:function(){return"3.2.5"}},{key:"env",get:function(){return'"production"'}},{key:"config",get:function(){return J}},{key:"utils",get:function(){return X}},{key:"scheme",get:function(){return Y}},{key:"Emitter",get:function(){return f}},{key:"validator",get:function(){return l}},{key:"kindOf",get:function(){return l.kindOf}},{key:"option",get:function(){return{container:"#artplayer",url:"",poster:"",title:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,loop:!1,flip:!1,playbackRate:!1,aspectRatio:!1,screenshot:!1,setting:!1,hotkey:!0,pip:!1,mutex:!0,fullscreen:!1,fullscreenWeb:!1,subtitleOffset:!1,miniProgressBar:!1,localVideo:!1,localSubtitle:!1,autoPip:!1,networkMonitor:!1,layers:[],contextmenu:[],quality:[],controls:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,width:160,height:90,column:10},subtitle:{url:"",style:{}},moreVideoAttr:{controls:!1,preload:"metadata"},icons:{},customType:{},lang:navigator.language.toLowerCase()}}}]),r}(f);return Object.defineProperty(be,"instances",{value:[]}),console.log("%c ArtPlayer %c 3.2.5 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),be})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Artplayer=e()}(this,(function(){"use strict";var t=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function e(t,e){for(var n=0;n1?n-1:0),i=1;i1&&void 0!==arguments[1]?arguments[1]:document).querySelector(t)}function d(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(e.querySelectorAll(t))}function h(t,e){return t.classList.add(e)}function y(t,e){return t.classList.remove(e)}function v(t,e){return t.classList.contains(e)}function m(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function g(t,e,n){return t.style[e]=n,t}function b(t,e){return Object.keys(e).forEach((function(n){g(t,n,e[n])})),t}function w(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=window.getComputedStyle(t,null).getPropertyValue(e);return n?parseFloat(r):r}function O(t){return Array.from(t.parentElement.children).filter((function(e){return e!==t}))}function j(t,e){O(t).forEach((function(t){return y(t,e)})),h(t,e)}function x(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"up";t.setAttribute("aria-label",e),t.setAttribute("data-balloon-pos",n)}var k=function(t){return-1!==Function.toString.call(t).indexOf("[native code]")},P=r((function(t){function e(n,r,i){return!function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}()?t.exports=e=function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&s(i,n.prototype),i}:t.exports=e=Reflect.construct,e.apply(null,arguments)}t.exports=e})),S=function(e){function n(e,r){var i;return t(this,n),i=a(this,c(n).call(this,e)),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(o(i),r||i.constructor),i.name="ArtPlayerError",i}return u(n,e),n}(r((function(t){function e(n){var r="function"==typeof Map?new Map:void 0;return t.exports=e=function(t){if(null===t||!k(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,e)}function e(){return P(t,arguments,c(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),s(e,t)},e(n)}t.exports=e}))(Error));function E(t,e){if(!t)throw new S(e);return t}function $(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 R(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function C(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 n(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(/[:.]/).map((function(t,e,n){if(e===n.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===n.length-1?".".concat(t):":".concat(t)})).join("")}return"WEBVTT\n\n".concat(t.split(/\r?\n/).map((function(t){var r=t.match(e);return r?{start:n(r[1].trim()),end:n(r[2].trim()),text:r[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 D(t){return t.includes("?")?D(t.split("?")[0]):t.includes("#")?D(t.split("#")[0]):t.trim().toLowerCase().split(".").pop()}function T(t,e){var n=document.createElement("a");n.style.display="none",n.href=t,n.download=e,document.body.appendChild(n),n.click(),document.body.removeChild(n)}var L=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e1?e-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(e){return setTimeout(e,t)}))}function N(t,e,n){var r;function i(){for(var i=arguments.length,o=new Array(i),a=0;a0?[e,n,r]:[n,r]).map((function(t){return t<10?"0".concat(t):String(t)})).join(":")}var X=Object.freeze({__proto__:null,query:p,queryAll:d,addClass:h,removeClass:y,hasClass:v,append:m,remove:function(t){return t.parentNode.removeChild(t)},setStyle:g,setStyles:b,getStyle:w,sublings:O,inverseClass:j,tooltip:x,ArtPlayerError:S,errorHandle:E,srtToVtt:$,vttToBlob:R,assToVtt:C,getExt:D,downloadFile:T,def:z,has:V,proxyPropertys:F,mergeDeep:H,sleep:B,debounce:N,throttle:I,clamp:U,secondToTime:_});function Z(t,e,n){return E("string"===e||t instanceof Element,"".concat(n.join(".")," require 'string' or 'Element' type"))}var Y={container:Z,url:"string",poster:"string",title:"string",theme:"string",lang:"string",volume:"number",isLive:"boolean",muted:"boolean",autoplay:"boolean",autoSize:"boolean",loop:"boolean",flip:"boolean",playbackRate:"boolean",aspectRatio:"boolean",screenshot:"boolean",setting:"boolean",hotkey:"boolean",pip:"boolean",mutex:"boolean",fullscreen:"boolean",fullscreenWeb:"boolean",subtitleOffset:"boolean",miniProgressBar:"boolean",localVideo:"boolean",localSubtitle:"boolean",networkMonitor:"boolean",plugins:["function"],whitelist:["string|function|regexp"],layers:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:Z,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined"}],contextmenu:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:Z,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined"}],quality:[{default:"boolean|undefined",name:"string",url:"string"}],controls:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:Z,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined",position:function(t,e,n){var r=["top","left","right"];return E(r.includes(t),"".concat(n.join(".")," only accept ").concat(r.toString()," as parameters"))}}],highlight:[{time:"number",text:"string"}],thumbnails:{url:"string",number:"number",width:"number",height:"number",column:"number"},subtitle:{url:"string",style:"object"},moreVideoAttr:"object",icons:"object",customType:"object"},J={propertys:["audioTracks","autoplay","buffered","controller","controls","crossOrigin","currentSrc","currentTime","defaultMuted","defaultPlaybackRate","duration","ended","error","loop","mediaGroup","muted","networkState","paused","playbackRate","played","preload","readyState","seekable","seeking","src","startDate","textTracks","videoTracks","volume"],methods:["addTextTrack","canPlayType","load","play","pause"],events:["abort","canplay","canplaythrough","durationchange","emptied","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"]},G=function e(n){var r=this;t(this,e);var i=n.constructor.kindOf,o=n.option.whitelist;this.ua=navigator.userAgent,this.isMobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(this.ua),this.state=!this.isMobile||o.some((function(t){switch(i(t)){case"string":return r.ua.indexOf(t)>-1;case"function":return t(r.ua);case"regexp":return t.test(r.ua);default:return!1}}))},Q=function(){function e(n){var r=this;t(this,e),this.art=n,n.option.container instanceof Element?this.$container=n.option.container:(this.$container=p(n.option.container),E(this.$container,"No container element found by ".concat(n.option.container))),E(n.constructor.instances.every((function(t){return t.template.$container!==r.$container})),"Cannot mount multiple instances on the same dom element"),E(this.$container.clientWidth&&this.$container.clientHeight,"The width and height of the container cannot be 0"),n.whitelist.state?this.desktop():this.mobile()}return n(e,[{key:"query",value:function(t){return p(t,this.$container)}},{key:"desktop",value:function(){this.$container.innerHTML='
Player version:
3.2.5
Video url:
Video volume:
Video time:
Video duration:
Video resolution:
x
[x]
xD7
'),this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video"),this.$track=this.query(".art-video track"),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.$pipHeader=this.query(".art-pip-header"),this.$pipTitle=this.query(".art-pip-title"),this.$pipClose=this.query(".art-pip-close"),this.$contextmenu=this.query(".art-contextmenus")}},{key:"mobile",value:function(){this.$container.innerHTML='
',this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video")}},{key:"destroy",value:function(t){t?this.$container.innerHTML="":h(this.$player,"art-destroy")}}]),e}(),K={"Video info":"视频统计信息",Close:"关闭","Video load failed":"视频加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音",Flip:"视频翻转",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":"迷你播放器","Exit mini player":"退出迷你播放器","Local Subtitle":"本地字幕","Local Video":"本地视频","Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},tt={"Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"影片翻轉",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":"迷你播放器","Exit mini player":"退出迷你播放器","Local Subtitle":"本地字幕","Local Video":"本地視頻","Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"},et=function(){function e(n){t(this,e),this.art=n,this.languages={"zh-cn":K,"zh-tw":tt},this.init()}return n(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=H(this.languages,t),this.init()}}]),e}();var nt=r((function(t){!function(){var e="undefined"!=typeof window&&void 0!==window.document?window.document:{},n=t.exports,r=function(){for(var t,n=[["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"]],r=0,i=n.length,o={};rh){var y=h*l/u;g(r,"width","".concat(100*y,"%")),g(r,"height","100%"),g(r,"padding","0 ".concat((f-f*y)/2,"px"))}else{var v=u/h/l;g(r,"width","100%"),g(r,"height","".concat(100*v,"%")),g(r,"padding","".concat((p-p*v)/2,"px 0"))}}i.dataset.aspectRatio=n,a.show="".concat(o.get("Aspect ratio"),": ").concat("default"===n?o.get("Default"):n),t.emit("aspectRatioChange",n)}else e.aspectRatio&&(g(r,"width",null),g(r,"height",null),g(r,"padding",null),delete i.dataset.aspectRatio,t.emit("aspectRatioRemove"))}}),z(e,"aspectRatioReset",{set:function(n){if(n&&e.aspectRatio){var r=e.aspectRatio;e.aspectRatio=r,t.emit("aspectRatioReset")}}})}(n,this),function(t,e){var n=t.option,r=t.notice,i=t.template.$video;z(e,"getScreenshotDataURL",{value:function(){try{var t=document.createElement("canvas");return t.width=i.videoWidth,t.height=i.videoHeight,t.getContext("2d").drawImage(i,0,0),t.toDataURL("image/png")}catch(t){throw r.show=t,t}}}),z(e,"getScreenshotBlobUrl",{value:function(){return new Promise((function(t,e){try{var n=document.createElement("canvas");n.width=i.videoWidth,n.height=i.videoHeight,n.getContext("2d").drawImage(i,0,0),n.toBlob((function(e){t(URL.createObjectURL(e))}))}catch(t){r.show=t,e(t)}}))}}),z(e,"screenshot",{value:function(){var r=e.getScreenshotDataURL();r&&(T(r,"".concat(n.title||"artplayer","_").concat(_(i.currentTime),".png")),t.emit("screenshot",r))}})}(n,this),function(t,e){var n=t.template.$player;z(e,"fullscreen",{get:function(){return nt.isFullscreen},set:function(r){e.fullscreenWeb&&(e.fullscreenWeb=!1),r?nt.request(n).then((function(){h(n,"art-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenChange",!0)})):nt.exit().then((function(){y(n,"art-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenChange",!1)}))}}),z(e,"fullscreenToggle",{set:function(t){t&&(e.fullscreen=!e.fullscreen)}})}(n,this),function(t,e){var n=t.template.$player;z(e,"fullscreenWeb",{get:function(){return v(n,"art-web-fullscreen")},set:function(r){e.fullscreen&&(e.fullscreen=!1),r?(h(n,"art-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWebChange",!0)):(y(n,"art-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWebChange",!1))}}),z(e,"fullscreenWebToggle",{set:function(t){t&&(e.fullscreenWeb=!e.fullscreenWeb)}})}(n,this),rt(n,this),function(t,e){var n=t.template.$video;z(e,"loaded",{get:function(){return e.loadedTime/n.duration}}),z(e,"loadedTime",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1):0}})}(n,this),function(t,e){z(e,"played",{get:function(){return e.currentTime/e.duration}})}(0,this),function(t,e){var n=t.template.$video;z(e,"playing",{get:function(){return!!(n.currentTime>0&&!n.paused&&!n.ended&&n.readyState>2)}})}(n,this),function(t,e){var n=t.template,r=n.$container,i=n.$player,o=n.$video;z(e,"autoSize",{get:function(){return v(r,"art-auto-size")},set:function(n){if(n){var a=o.videoWidth,c=o.videoHeight,s=r.getBoundingClientRect(),u=s.width,l=s.height,f=a/c,p=u/l;if(h(r,"art-auto-size"),p>f){g(i,"width","".concat(l*f/u*100,"%")),g(i,"height","100%")}else{var d=u/f/l*100;g(i,"width","100%"),g(i,"height","".concat(d,"%"))}t.emit("autoSizeChange",{width:e.width,height:e.height})}else y(r,"art-auto-size"),g(i,"width",null),g(i,"height",null),t.emit("autoSizeRemove")}})}(n,this),function(t,e){z(e,"rect",{get:function(){return t.template.$player.getBoundingClientRect()}}),["bottom","height","left","right","top","width"].forEach((function(t){z(e,t,{get:function(){return e.rect[t]}})})),z(e,"x",{get:function(){return e.left+window.pageXOffset}}),z(e,"y",{get:function(){return e.top+window.pageYOffset}})}(n,this),function(t,e){var n=t.template.$player;z(e,"flip",{get:function(){return n.dataset.flip},set:function(e){if(e){var r=["normal","horizontal","vertical"];E(r.includes(e),"'flip' only accept ".concat(r.toString()," as parameters")),n.dataset.flip=e,t.emit("flipChange",e)}else delete n.dataset.flip,t.emit("flipRemove")}})}(n,this),F(n,this)};var ot=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=c(t)););return t},at=r((function(t){function e(n,r,i){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=e=Reflect.get:t.exports=e=function(t,e,n){var r=ot(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}},e(n,r,i||n)}t.exports=e})),ct=function(){function e(n){t(this,e),this.id=0,this.art=n,this.add=this.add.bind(this),this.name=this.constructor.name.toLowerCase()}return n(e,[{key:"add",value:function(t,e){var n=this,r="function"==typeof t?t(this.art):t;if(this.$parent&&!r.disable){this.id+=1;var i=r.name||"".concat(this.name).concat(this.id),o=document.createElement("div");o.classList.value="art-".concat(this.name," art-").concat(this.name,"-").concat(i),r.html&&m(o,r.html),r.style&&b(o,r.style),r.tooltip&&x(o,r.tooltip);var a=Array.from(this.$parent.children);o.dataset.index=r.index||this.id;var c=a.find((function(t){return Number(t.dataset.index)>=Number(o.dataset.index)}));c?c.insertAdjacentElement("beforebegin",o):m(this.$parent,o),r.click&&this.art.events.proxy(o,"click",(function(t){t.preventDefault(),r.click.call(n.art,n,t)})),r.mounted&&r.mounted(o,this,this.art),e&&e(o,this,this.art),this.art.emit("".concat(this.name,":add"),r)}}},{key:"show",get:function(){return v(this.art.template.$player,"art-".concat(this.name,"-show"))},set:function(t){var e=this.art.template.$player,n="art-".concat(this.name,"-show");t?h(e,n):y(e,n),this.art.emit("".concat(this.name,":toggle"),t)}},{key:"toggle",set:function(t){t&&(this.show=!this.show)}}]),e}();var st=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};function ut(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function lt(t){return function(e){return function(t){for(var e=1;e
'),mounted:function(t){var n=!1,i=p(".art-progress-loaded",t),c=p(".art-progress-played",t),s=p(".art-progress-highlight",t),u=p(".art-progress-indicator",t),l=p(".art-progress-tip",t);function f(t,e){"loaded"===t&&g(i,"width","".concat(100*e,"%")),"played"===t&&(g(c,"width","".concat(100*e,"%")),g(u,"left","calc(".concat(100*e,"% - ").concat(w(u,"width")/2,"px)")))}r.forEach((function(t){var e=U(t.time,0,a.duration)/a.duration*100;m(s,''))})),f("loaded",a.loaded),e.on("video:progress",(function(){f("loaded",a.loaded)})),e.on("video:timeupdate",(function(){f("played",a.played)})),e.on("video:ended",(function(){f("played",1)})),o(t,"mousemove",(function(n){g(l,"display","block"),n.composedPath().indexOf(s)>-1?function(n){var r=gt(e,n).width,i=n.target.dataset.text;l.innerHTML=i;var o=l.clientWidth;r<=o/2?g(l,"left",0):r>t.clientWidth-o/2?g(l,"left","".concat(t.clientWidth-o,"px")):g(l,"left","".concat(r-o/2,"px"))}(n):function(n){var r=gt(e,n),i=r.width,o=r.time;l.innerHTML=o;var a=l.clientWidth;i<=a/2?g(l,"left",0):i>t.clientWidth-a/2?g(l,"left","".concat(t.clientWidth-a,"px")):g(l,"left","".concat(i-a/2,"px"))}(n)})),o(t,"mouseout",(function(){g(l,"display","none")})),o(t,"click",(function(t){if(t.target!==u){var n=gt(e,t),r=n.second;f("played",n.percentage),a.seek=r}})),o(u,"mousedown",(function(){n=!0})),o(document,"mousemove",(function(t){if(n){var r=gt(e,t),i=r.second,o=r.percentage;h(u,"art-show-indicator"),f("played",o),a.seek=i}})),o(document,"mouseup",(function(){n&&(n=!1,y(u,"art-show-indicator"))}))}})}}function wt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ot(t){return function(e){return function(t){for(var e=1;e'),l=m(u,'
');function f(t){var e=u.getBoundingClientRect(),n=e.left,r=e.width,i=l.getBoundingClientRect().width;return U(t.pageX-n-i/2,0,r-i/2)/(r-i)}function p(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.7;if(i.muted||0===t)g(c,"display","none"),g(s,"display","flex"),g(l,"left","0");else{var e=((w(u,"width")||60)-w(l,"width"))*t;g(c,"display","flex"),g(s,"display","none"),g(l,"left","".concat(e,"px"))}}x(c,o.get("Mute")),g(s,"display","none"),p(i.volume),e.on("video:volumechange",(function(){p(i.volume)})),n(c,"click",(function(){i.muted=!0})),n(s,"click",(function(){i.muted=!1})),n(u,"click",(function(t){i.muted=!1,i.volume=f(t)})),n(l,"mousedown",(function(){a=!0})),n(document,"mousemove",(function(t){a&&(i.muted=!1,i.volume=f(t))})),n(document,"mouseup",(function(){a&&(a=!1)}))}})}}function St(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Et(t){return function(e){return function(t){for(var e=1;er.clientWidth-s/2?g(t,"left","".concat(r.clientWidth-s,"px")):g(t,"left","".concat(o-s/2,"px"))}(i))})),o(r,"mouseout",(function(){g(t,"display","none")}))}})}}function Ct(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Dt(t){return function(e){return function(t){for(var e=1;e'.concat(s.name,"")),l=n.map((function(t,e){return'
').concat(t.name,"
")})).join(""),f=m(t,'
'.concat(l,"
"));o(t,(function(){f.style.left="-".concat(w(f,"width")/2-t.clientWidth/2,"px")})),i(f,"click",(function(t){var e=Number(t.target.dataset.index),r=n[e],i=r.url,o=r.name;i&&o&&c!==e&&(a.switchQuality(i,o),u.innerText=o,c=e)}))}})}}var At=function(e){function r(e){var n;t(this,r),n=a(this,c(r).call(this,e));var i=e.option;return e.on("ready",(function(){n.add(bt({name:"progress",disable:i.isLive,position:"top",index:10})),n.add(Rt({name:"thumbnails",disable:!i.thumbnails.url||i.isLive,position:"top",index:20})),n.add(vt({name:"playAndPause",disable:!1,position:"left",index:10})),n.add(Pt({name:"volume",disable:!1,position:"left",index:20})),n.add(xt({name:"time",disable:i.isLive,position:"left",index:30})),n.add(Lt({name:"quality",disable:0===i.quality.length,position:"right",index:10})),n.add(Dt({name:"screenshot",disable:!i.screenshot,position:"right",index:20})),n.add(Ot({name:"subtitle",disable:!i.subtitle.url,position:"right",index:30})),n.add(Et({name:"setting",disable:!i.setting,position:"right",index:40})),n.add(ht({name:"pip",disable:!i.pip,position:"right",index:50})),n.add(pt({name:"fullscreenWeb",disable:!i.fullscreenWeb,position:"right",index:60})),n.add(lt({name:"fullscreen",disable:!i.fullscreen,position:"right",index:70})),i.controls.forEach((function(t){n.add(t)}))})),n}return u(r,e),n(r,[{key:"add",value:function(t,e){var n=this,i="function"==typeof t?t(this.art):t;E(["top","left","right"].includes(i.position),"Control option.position must one of 'top', 'left', 'right'");var o=this.art.template,a=o.$progress,s=o.$controlsLeft,u=o.$controlsRight;switch(i.position){case"top":this.$parent=a;break;case"left":this.$parent=s;break;case"right":this.$parent=u}at(c(r.prototype),"add",this).call(this,i,(function(t){i.disable||"top"===i.position||t.firstElementChild&&"I"===t.firstElementChild.tagName||h(t,"art-control-onlyText"),e&&e(t,n,n.art)}))}}]),r}(ct);function Mt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function qt(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e0.50.75').concat(n.get("Normal"),'1.251.52.0'),click:function(t,e){var n=e.target.dataset.rate;n&&(r.playbackRate=Number(n),t.show=!1)},mounted:function(t){e.on("playbackRateChange",(function(e){var n=d("span",t).find((function(t){return Number(t.dataset.rate)===e}));n&&j(n,"art-current")}))}})}}function zt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Wt(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e').concat(n.get("Default"),'4:316:9'),click:function(t,e){var n=e.target.dataset.ratio;n&&(r.aspectRatio=n,t.show=!1)},mounted:function(t){e.on("aspectRatioChange",(function(e){var n=d("span",t).find((function(t){return t.dataset.ratio===e}));n&&j(n,"art-current")}))}})}}function Vt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ft(t){return function(e){return function(t){for(var e=1;eArtPlayer 3.2.5'})}function Nt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function It(t){return function(e){return function(t){for(var e=1;ec+a&&(h=a-d),n+p>l+o&&(y=o-p),b(u,{top:"".concat(y,"px"),left:"".concat(h,"px")})})),l(s,"click",(function(t){t.composedPath().includes(u)||(r.show=!1)})),e.on("blur",(function(){r.show=!1}))})),r}return u(n,e),n}(ct),_t=function(e){function n(e){var r;t(this,n),r=a(this,c(n).call(this,e));var i=e.template,o=i.$infoPanel,s=i.$infoClose,u=i.$video;(0,e.events.proxy)(s,"click",(function(){r.show=!1}));var l=null,f=d("[data-video]",o);return e.on("destroy",(function(){clearTimeout(l)})),e.on("info:toggle",(function(t){clearTimeout(l),t&&function t(){f.forEach((function(t){var e=u[t.dataset.video];t.innerText="number"==typeof e?e.toFixed(2):e})),l=setTimeout((function(){t()}),1e3)}()})),r}return u(n,e),n}(ct),Xt=function(e){function r(e){var n;t(this,r),n=a(this,c(r).call(this,e));var i=e.events.proxy,s=e.option.subtitle;return b(e.template.$subtitle,s.style),i(n.textTrack,"cuechange",n.update.bind(o(n))),s.url&&n.init(s.url),n}return u(r,e),n(r,[{key:"update",value:function(){var t=this.art.template.$subtitle;t.innerHTML="",this.activeCue&&(t.innerHTML=this.activeCue.text.split(/\r?\n/).map((function(t){return"

".concat(t,"

")})).join(""),this.art.emit("subtitle:update",this.activeCue.text))}},{key:"switch",value:function(t,e,n){var r=this,i=this.art,o=i.i18n,a=i.notice;return this.init(t,n).then((function(t){return e&&(a.show="".concat(o.get("Switch subtitle"),": ").concat(e)),r.art.emit("subtitle:switch",t),t}))}},{key:"init",value:function(t,e){var n=this,r=this.art,i=r.notice,o=r.template,a=o.$subtitle,c=o.$track;return fetch(t).then((function(t){return t.text()})).then((function(r){switch(n.art.emit("subtitle:load",t),e||D(t)){case"srt":return R($(r));case"ass":return R(C(r));case"vtt":return R(r);default:return t}})).then((function(t){return a.innerHTML="",n.url===t?t:(URL.revokeObjectURL(n.url),c.src=t,t)})).catch((function(t){throw i.show=t,n.art.emit("subtitle:err",t),t}))}},{key:"url",get:function(){return this.art.template.$track.src}},{key:"textTrack",get:function(){return this.art.template.$video.textTracks[0]}},{key:"activeCue",get:function(){return this.textTrack.activeCues[0]}}]),r}(ct);var Zt=function(){function e(n){var r=this;t(this,e),this.destroyEvents=[],this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),this.loadImg=this.loadImg.bind(this),n.whitelist.state&&n.on("ready",(function(){!function(t,e){var n=t.template.$player;e.proxy(document,["click","contextmenu"],(function(e){e.composedPath().indexOf(n)>-1?(t.isFocus=!0,t.emit("focus")):(t.isFocus=!1,t.emit("blur"))}))}(n,r),function(t,e){var n=t.template.$player;e.hover(n,(function(){h(n,"art-hover"),t.emit("hoverenter")}),(function(){y(n,"art-hover"),t.emit("hoverleave")}))}(n,r),function(t,e){var n=t.template,r=n.$player,i=n.$video,o=t.player,a=t.controls,c=N((function(){h(r,"art-hide-cursor"),y(r,"art-hover"),a.show=!1}),3e3);t.on("hoverleave",(function(){o.playing&&c()})),e.proxy(r,"mousemove",(function(e){c.clearTimeout(),y(r,"art-hide-cursor"),a.show=!0,!o.pip&&o.playing&&e.target===i&&c(),t.emit("mousemove")}))}(n,r),function(t,e){var n=t.option,r=t.player,i=t.template.$player,o=document.createElement("object");o.setAttribute("aria-hidden","true"),o.setAttribute("tabindex",-1),o.type="text/html",o.data="about:blank";var a=r.width,c=r.height,s=I((function(){r.width===a&&r.height===c||(a=r.width,c=r.height,n.autoSize&&(r.fullscreen||r.fullscreenWeb||r.pip?r.autoSize=!1:r.autoSize=!0),r.aspectRatioReset=!0,t.emit("resize",{width:r.width,height:r.height}))}),500);e.proxy(o,"load",(function(){e.proxy(o.contentDocument.defaultView,"resize",s)})),i.appendChild(o)}(n,r)}))}return n(e,[{key:"proxy",value:function(t,e,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(Array.isArray(e))return e.map((function(e){return r.proxy(t,e,n,i)}));t.addEventListener(e,n,i);var o=function(){return t.removeEventListener(e,n,i)};return this.destroyEvents.push(o),o}},{key:"hover",value:function(t,e,n){e&&this.proxy(t,"mouseenter",e),n&&this.proxy(t,"mouseleave",n)}},{key:"loadImg",value:function(t){var e=this;return new Promise((function(n,r){var i;if(t instanceof HTMLImageElement)i=t;else{if("string"!=typeof t)return r(t);(i=new Image).src=t}return i.complete?n(i):(e.proxy(i,"load",(function(){return n(i)})),e.proxy(i,"error",(function(){return r(i)})),t)}))}},{key:"destroy",value:function(){this.destroyEvents.forEach((function(t){return t()}))}}]),e}(),Yt=function(){function e(n){var r=this;t(this,e),this.keys={};var i=n.option,o=n.player,a=n.events.proxy;i.hotkey&&n.on("ready",(function(){r.add(27,(function(){o.fullscreenWeb&&(o.fullscreenWeb=!1)})),r.add(32,(function(){o.toggle=!0})),r.add(37,(function(){o.seek=o.currentTime-5})),r.add(38,(function(){o.volume+=.1})),r.add(39,(function(){o.seek=o.currentTime+5})),r.add(40,(function(){o.volume-=.1})),a(window,"keydown",(function(t){if(n.isFocus){var e=document.activeElement.tagName.toUpperCase(),i=document.activeElement.getAttribute("contenteditable");if("INPUT"!==e&&"TEXTAREA"!==e&&""!==i&&"true"!==i){var o=r.keys[t.keyCode];o&&(t.preventDefault(),o.forEach((function(t){return t()})),n.emit("hotkey",t))}}}))}))}return n(e,[{key:"add",value:function(t,e){this.keys[t]?this.keys[t].push(e):this.keys[t]=[e]}}]),e}(),Jt=function(e){function n(e){var r;return t(this,n),(r=a(this,c(n).call(this,e))).$parent=e.template.$layer,e.on("ready",(function(){e.option.layers.forEach((function(t){r.add(t)}))})),r}return u(n,e),n}(ct),Gt=function(e){function n(e){var r;return t(this,n),r=a(this,c(n).call(this,e)),m(e.template.$loading,e.icons.loading),r}return u(n,e),n}(ct),Qt=function(){function e(n){t(this,e),this.art=n,this.time=2e3,this.timer=null}return n(e,[{key:"show",set:function(t){var e=this.art.template,n=e.$player,r=e.$noticeInner;r.innerText=t instanceof Error?t.message.trim():t,h(n,"art-notice-show"),clearTimeout(this.timer),this.timer=setTimeout((function(){r.innerText="",y(n,"art-notice-show")}),this.time)}}]),e}(),Kt=function(e){function n(e){var r;return t(this,n),r=a(this,c(n).call(this,e)),m(e.template.$state,e.icons.state),r}return u(n,e),n}(ct);function te(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}var ee=function e(n){var r=this;t(this,e);var i=function(t){for(var e=1;e',state:'',play:'',pause:'',volume:'',volumeClose:'',subtitle:'',screenshot:'\t',setting:'',fullscreen:'\t\t\t\t',fullscreenWeb:'\t',pip:''},n.option.icons);Object.keys(i).forEach((function(t){var e=document.createElement("i");e.classList.add("art-icon"),e.classList.add("art-icon-".concat(t)),m(e,i[t]),r[t]=e}))};function ne(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function re(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e'.concat(n.get("Flip"),'
"),click:function(t,e){var n=e.target.dataset.value;n&&(r.flip=n)},mounted:function(t){e.on("flipChange",(function(e){var n=d("button",t).find((function(t){return t.dataset.value===e}));n&&j(n.parentElement,"current")}))}})}}function ie(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function oe(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e'.concat(n.get("Aspect ratio"),'
'),click:function(t,e){var n=e.target.dataset.value;n&&(r.aspectRatio=n)},mounted:function(t){e.on("aspectRatioChange",(function(e){var n=d("button",t).find((function(t){return t.dataset.value===e}));n&&j(n.parentElement,"current")}))}})}}function ae(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function ce(t){return function(e){var n=e.i18n,r=e.player,i=e.events.proxy;return function(t){for(var e=1;e'.concat(n.get("Play speed"),': 1.0x
'),mounted:function(t){var n=p(".art-setting-range input",t),o=p(".art-subtitle-value",t);i(n,"change",(function(){var t=n.value;o.innerText=t,r.playbackRate=Number(t)})),e.on("playbackRateChange",(function(t){n.value!==t&&(n.value=t,o.innerText=t)}))}})}}var se=function(e){function n(e){var r;t(this,n),r=a(this,c(n).call(this,e));var i=e.option,o=e.template,s=o.$setting,u=o.$settingBody,l=e.events.proxy;return r.$parent=u,i.setting&&(e.on("ready",(function(){l(s,"click",(function(t){t.target===s&&(r.show=!1)})),r.add(re({disable:!i.flip,name:"flip"})),r.add(oe({disable:!i.aspectRatio,name:"aspectRatio"})),r.add(ce({disable:!i.playbackRate,name:"playbackRate"}))})),e.on("blur",(function(){r.show=!1}))),r}return u(n,e),n}(ct),ue=function(){function e(){t(this,e),this.name="artplayer_settings"}return n(e,[{key:"get",value:function(t){var e=JSON.parse(localStorage.getItem(this.name))||{};return t?e[t]:{}}},{key:"set",value:function(t,e){var n=Object.assign({},this.get(),st({},t,e));localStorage.setItem(this.name,JSON.stringify(n))}},{key:"del",value:function(t){var e=this.get();delete e[t],localStorage.setItem(this.name,JSON.stringify(e))}},{key:"clean",value:function(){localStorage.removeItem(this.name)}}]),e}();function le(t){var e=t.i18n,n=t.subtitle,r=t.events.proxy;return{title:"Subtitle",name:"subtitleOffset",index:20,html:'
'.concat(e.get("Subtitle offset time"),': 0s
'),mounted:function(e){var i=p(".art-setting-range input",e),o=p(".art-subtitle-value",e);r(i,"change",(function(){var e=i.value;o.innerText=e,t.plugins.subtitleOffset.offset(Number(e))})),t.on("subtitle:switch",(function(){i.value=0,o.innerText=0})),t.on("subtitleOffset",(function(t){n.update(),i.value!==t&&(i.value=t,o.innerText=t)}))}}}function fe(t){var e=t.constructor.utils.clamp,n=t.setting,r=t.notice,i=t.template,o=t.i18n,a=t.player;n.add(le);var c=[];return t.on("subtitle:switch",(function(){c=[]})),{name:"subtitleOffset",offset:function(n){if(i.$track&&i.$track.track){var s=Array.from(i.$track.track.cues),u=e(n,-5,5);s.forEach((function(t,n){c[n]||(c[n]={startTime:t.startTime,endTime:t.endTime}),t.startTime=e(c[n].startTime+u,0,a.duration),t.endTime=e(c[n].endTime+u,0,a.duration)})),r.show="".concat(o.get("Subtitle offset time"),": ").concat(n,"s"),t.emit("subtitleOffset",n)}else r.show="".concat(o.get("No subtitles found")),t.emit("subtitleOffset",0)}}}function pe(t){var e=t.events.proxy,n=t.template,r=t.player,i=t.option,o=t.setting,a=t.i18n;function c(e){if(e){var o=n.$video.canPlayType(e.type);if("maybe"===o||"probably"===o){var a=URL.createObjectURL(e);i.title=e.name,r.switchUrl(a,e.name),t.emit("localVideo",e)}else E(!1,"Playback of this file format is not supported")}}function s(t){var n=m(t,'');g(t,"position","relative"),b(n,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(n,"change",(function(){c(n.files[0])}))}return e(n.$player,"dragover",(function(t){t.preventDefault()})),e(n.$player,"drop",(function(t){t.preventDefault(),c(t.dataTransfer.files[0])})),t.on("ready",(function(){o.add({title:"Local Video",name:"localVideo",index:30,html:'
'.concat(a.get("Local Video"),'
').concat(a.get("Open"),'
'),mounted:function(e){var n=p(".art-upload-btn",e),r=p(".art-upload-value",e);t.on("localVideo",(function(t){r.textContent=t.name,r.title=t.name})),s(n)}})})),{name:"localVideo",attach:s}}function de(t){var e=t.events.proxy,n=t.subtitle,r=t.setting,i=t.i18n;function o(r){var i=m(r,'');g(r,"position","relative"),b(i,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(i,"change",(function(){!function(e){if(e){var r=D(e.name);if(["ass","vtt","srt"].includes(r)){var i=URL.createObjectURL(e);n.switch(i,e.name,r),t.emit("localSubtitle",e)}else E(!1,"Only supports subtitle files in .ass, .vtt and .srt format")}}(i.files[0])}))}return t.on("ready",(function(){r.add({title:"Local Subtitle",name:"localSubtitle",index:40,html:'
'.concat(i.get("Local Subtitle"),'
').concat(i.get("Open"),'
'),mounted:function(e){var n=p(".art-upload-btn",e),r=p(".art-upload-value",e);t.on("localSubtitle",(function(t){r.textContent=t.name,r.title=t.name})),o(n)}})})),{name:"localSubtitle",attach:o}}function he(t){var e=t.layers,n=t.player,r=t.option.theme;return e.add({name:"miniProgressBar",style:{display:"none",position:"absolute",left:0,right:0,bottom:0,height:"2px",background:r},mounted:function(e){t.on("control:toggle",(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*n.played,"%")}))}}),{name:"miniProgressBar"}}function ye(t){var e=1e4,n=0,r=0,i=0,o=null;function a(){n=0,r=0,i=0,cancelAnimationFrame(o),o=null}function c(){o||function a(){t.isDestroy||(o=requestAnimationFrame((function(){var o=Date.now();if(i){var c=o-i;r+=c,t.player.playing||(n+=c)}i=o,t.emit("networkMonitor",n/r),r>=e&&(n=0,r=0),a()})))}()}return t.on("play",c),t.on("pause",a),{name:"networkMonitor",reset:a,start:c,sample:function(t){e=t}}}var ve=function(){function e(n){var r=this;t(this,e),this.art=n,this.id=0;var i=n.option;i.subtitle.url&&i.subtitleOffset&&this.add(fe),!i.isLive&&i.miniProgressBar&&this.add(he),i.localVideo&&this.add(pe),i.localSubtitle&&this.add(de),i.networkMonitor&&this.add(ye),n.option.plugins.forEach((function(t){r.add(t)}))}return n(e,[{key:"add",value:function(t){this.id+=1;var e=t.call(this,this.art),n="";return E(!V(this,n=e&&e.name?e.name:t.name?t.name:"plugin".concat(this.id)),"Cannot add a plugin that already has the same name: ".concat(n)),Object.defineProperty(this,n,{value:e}),this.art.emit("plugin:add",t),this}}]),e}(),me=function e(n){t(this,e);var r=n.option,i=n.events.proxy,o=n.template.$video;J.events.forEach((function(t){i(o,t,(function(t){n.emit("video:".concat(t.type),t)}))})),Object.keys(r.moreVideoAttr).forEach((function(t){o[t]=r.moreVideoAttr[t]})),r.muted&&(o.muted=r.muted),r.volume&&(o.volume=U(r.volume,0,1)),r.poster&&(o.poster=r.poster),r.autoplay&&(o.autoplay=r.autoplay),o.controls=!0;var a=r.type||D(r.url),c=r.customType[a];a&&c?(c(o,r.url,n),n.emit("customType",a)):(o.src=r.url,n.emit("urlChange",o.src))},ge=0,be=function(e){function r(e){var n;return t(this,r),(n=a(this,c(r).call(this))).option=l(H(r.option,e),Y),n.isFocus=!1,n.isDestroy=!1,n.whitelist=new G(o(n)),n.template=new Q(o(n)),n.events=new Zt(o(n)),n.whitelist.state?(n.storage=new ue(o(n)),n.icons=new ee(o(n)),n.i18n=new et(o(n)),n.notice=new Qt(o(n)),n.player=new it(o(n)),n.layers=new Jt(o(n)),n.controls=new At(o(n)),n.contextmenu=new Ut(o(n)),n.subtitle=new Xt(o(n)),n.info=new _t(o(n)),n.loading=new Gt(o(n)),n.hotkey=new Yt(o(n)),n.mask=new Kt(o(n)),n.setting=new se(o(n)),n.plugins=new ve(o(n))):n.mobile=new me(o(n)),ge+=1,n.id=ge,r.instances.push(o(n)),n}return u(r,e),n(r,[{key:"destroy",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.events.destroy(),this.template.destroy(t),r.instances.splice(r.instances.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}],[{key:"version",get:function(){return"3.2.5"}},{key:"env",get:function(){return'"production"'}},{key:"config",get:function(){return J}},{key:"utils",get:function(){return X}},{key:"scheme",get:function(){return Y}},{key:"Emitter",get:function(){return f}},{key:"validator",get:function(){return l}},{key:"kindOf",get:function(){return l.kindOf}},{key:"option",get:function(){return{container:"#artplayer",url:"",poster:"",title:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,loop:!1,flip:!1,playbackRate:!1,aspectRatio:!1,screenshot:!1,setting:!1,hotkey:!0,pip:!1,mutex:!0,fullscreen:!1,fullscreenWeb:!1,subtitleOffset:!1,miniProgressBar:!1,localVideo:!1,localSubtitle:!1,autoPip:!1,networkMonitor:!1,layers:[],contextmenu:[],quality:[],controls:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,width:160,height:90,column:10},subtitle:{url:"",style:{}},moreVideoAttr:{controls:!1,preload:"metadata"},icons:{},customType:{},lang:navigator.language.toLowerCase()}}}]),r}(f);return Object.defineProperty(be,"instances",{value:[]}),console.log("%c ArtPlayer %c 3.2.5 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),be})); diff --git a/packages/artplayer/dist/artplayer.js b/packages/artplayer/dist/artplayer.js index cc672bbce..f35b55983 100644 --- a/packages/artplayer/dist/artplayer.js +++ b/packages/artplayer/dist/artplayer.js @@ -5,4 +5,4 @@ * 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=t||self).Artplayer=e()}(this,(function(){"use strict";var t=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function e(t,e){for(var n=0;n1?n-1:0),i=1;i1&&void 0!==arguments[1]?arguments[1]:document).querySelector(t)}function d(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(e.querySelectorAll(t))}function h(t,e){return t.classList.add(e)}function y(t,e){return t.classList.remove(e)}function v(t,e){return t.classList.contains(e)}function m(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function g(t,e,n){return t.style[e]=n,t}function b(t,e){return Object.keys(e).forEach((function(n){g(t,n,e[n])})),t}function w(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=window.getComputedStyle(t,null).getPropertyValue(e);return n?parseFloat(r):r}function O(t){return Array.from(t.parentElement.children).filter((function(e){return e!==t}))}function j(t,e){O(t).forEach((function(t){return y(t,e)})),h(t,e)}function x(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"up";t.setAttribute("aria-label",e),t.setAttribute("data-balloon-pos",n)}var k=function(t){return-1!==Function.toString.call(t).indexOf("[native code]")},P=r((function(t){function e(n,r,i){return!function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}()?t.exports=e=function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&u(i,n.prototype),i}:t.exports=e=Reflect.construct,e.apply(null,arguments)}t.exports=e})),S=function(e){function n(e,r){var i;return t(this,n),i=a(this,c(n).call(this,e)),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(o(i),r||i.constructor),i.name="ArtPlayerError",i}return s(n,e),n}(r((function(t){function e(n){var r="function"==typeof Map?new Map:void 0;return t.exports=e=function(t){if(null===t||!k(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,e)}function e(){return P(t,arguments,c(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),u(e,t)},e(n)}t.exports=e}))(Error));function E(t,e){if(!t)throw new S(e);return t}function $(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 R(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function C(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 n(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(/[:.]/).map((function(t,e,n){if(e===n.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===n.length-1?".".concat(t):":".concat(t)})).join("")}return"WEBVTT\n\n".concat(t.split(/\r?\n/).map((function(t){var r=t.match(e);return r?{start:n(r[1].trim()),end:n(r[2].trim()),text:r[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 D(t){return t.includes("?")?D(t.split("?")[0]):t.includes("#")?D(t.split("#")[0]):t.trim().toLowerCase().split(".").pop()}function T(t,e){var n=document.createElement("a");n.style.display="none",n.href=t,n.download=e,document.body.appendChild(n),n.click(),document.body.removeChild(n)}var L=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e1?e-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(e){return setTimeout(e,t)}))}function N(t,e,n){var r;function i(){for(var i=arguments.length,o=new Array(i),a=0;a0?[e,n,r]:[n,r]).map((function(t){return t<10?"0".concat(t):String(t)})).join(":")}var X=Object.freeze({__proto__:null,query:p,queryAll:d,addClass:h,removeClass:y,hasClass:v,append:m,remove:function(t){return t.parentNode.removeChild(t)},setStyle:g,setStyles:b,getStyle:w,sublings:O,inverseClass:j,tooltip:x,ArtPlayerError:S,errorHandle:E,srtToVtt:$,vttToBlob:R,assToVtt:C,getExt:D,downloadFile:T,def:z,has:V,proxyPropertys:F,mergeDeep:H,sleep:B,debounce:N,throttle:I,clamp:U,secondToTime:_});function Z(t,e,n){return E("string"===e||t instanceof Element,"".concat(n.join(".")," require 'string' or 'Element' type"))}var Y={container:Z,url:"string",poster:"string",title:"string",theme:"string",lang:"string",volume:"number",isLive:"boolean",muted:"boolean",autoplay:"boolean",autoSize:"boolean",loop:"boolean",flip:"boolean",playbackRate:"boolean",aspectRatio:"boolean",screenshot:"boolean",setting:"boolean",hotkey:"boolean",pip:"boolean",mutex:"boolean",fullscreen:"boolean",fullscreenWeb:"boolean",subtitleOffset:"boolean",miniProgressBar:"boolean",localVideo:"boolean",localSubtitle:"boolean",networkMonitor:"boolean",plugins:["function"],whitelist:["string|function|regexp"],layers:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:Z,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined"}],contextmenu:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:Z,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined"}],quality:[{default:"boolean|undefined",name:"string",url:"string"}],controls:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:Z,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined",position:function(t,e,n){var r=["top","left","right"];return E(r.includes(t),"".concat(n.join(".")," only accept ").concat(r.toString()," as parameters"))}}],highlight:[{time:"number",text:"string"}],thumbnails:{url:"string",number:"number",width:"number",height:"number",column:"number"},subtitle:{url:"string",style:"object"},moreVideoAttr:"object",icons:"object",customType:"object"},J={propertys:["audioTracks","autoplay","buffered","controller","controls","crossOrigin","currentSrc","currentTime","defaultMuted","defaultPlaybackRate","duration","ended","error","loop","mediaGroup","muted","networkState","paused","playbackRate","played","preload","readyState","seekable","seeking","src","startDate","textTracks","videoTracks","volume"],methods:["addTextTrack","canPlayType","load","play","pause"],events:["abort","canplay","canplaythrough","durationchange","emptied","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"]},G=function e(n){var r=this;t(this,e);var i=n.constructor.kindOf,o=n.option.whitelist;this.ua=navigator.userAgent,this.isMobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(this.ua),this.state=!this.isMobile||o.some((function(t){switch(i(t)){case"string":return r.ua.indexOf(t)>-1;case"function":return t(r.ua);case"regexp":return t.test(r.ua);default:return!1}}))},Q=function(){function e(n){var r=this;t(this,e),this.art=n,n.option.container instanceof Element?this.$container=n.option.container:(this.$container=p(n.option.container),E(this.$container,"No container element found by ".concat(n.option.container))),E(n.constructor.instances.every((function(t){return t.template.$container!==r.$container})),"Cannot mount multiple instances on the same dom element"),E(this.$container.clientWidth&&this.$container.clientHeight,"The width and height of the container cannot be 0"),n.whitelist.state?this.desktop():this.mobile()}return n(e,[{key:"query",value:function(t){return p(t,this.$container)}},{key:"desktop",value:function(){this.$container.innerHTML='
Player version:
3.2.5
Video url:
Video volume:
Video time:
Video duration:
Video resolution:
x
[x]
xD7
'),this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video"),this.$track=this.query(".art-video track"),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.$pipHeader=this.query(".art-pip-header"),this.$pipTitle=this.query(".art-pip-title"),this.$pipClose=this.query(".art-pip-close"),this.$contextmenu=this.query(".art-contextmenus")}},{key:"mobile",value:function(){this.$container.innerHTML='
',this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video")}},{key:"destroy",value:function(t){t?this.$container.innerHTML="":h(this.$player,"art-destroy")}}]),e}(),K={"About author":"关于作者","Video info":"视频统计信息",Close:"关闭","Video load failed":"视频加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音",Flip:"视频翻转",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":"迷你播放器","Exit mini player":"退出迷你播放器","Local Subtitle":"本地字幕","Local Video":"本地视频","Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},tt={"About author":"關於作者","Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"影片翻轉",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":"迷你播放器","Exit mini player":"退出迷你播放器","Local Subtitle":"本地字幕","Local Video":"本地視頻","Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"},et=function(){function e(n){t(this,e),this.art=n,this.languages={"zh-cn":K,"zh-tw":tt},this.init()}return n(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=H(this.languages,t),this.init()}}]),e}();var nt=r((function(t){!function(){var e="undefined"!=typeof window&&void 0!==window.document?window.document:{},n=t.exports,r=function(){for(var t,n=[["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"]],r=0,i=n.length,o={};rh){var y=h*l/s;g(r,"width","".concat(100*y,"%")),g(r,"height","100%"),g(r,"padding","0 ".concat((f-f*y)/2,"px"))}else{var v=s/h/l;g(r,"width","100%"),g(r,"height","".concat(100*v,"%")),g(r,"padding","".concat((p-p*v)/2,"px 0"))}}i.dataset.aspectRatio=n,a.show="".concat(o.get("Aspect ratio"),": ").concat("default"===n?o.get("Default"):n),t.emit("aspectRatioChange",n)}else e.aspectRatio&&(g(r,"width",null),g(r,"height",null),g(r,"padding",null),delete i.dataset.aspectRatio,t.emit("aspectRatioRemove"))}}),z(e,"aspectRatioReset",{set:function(n){if(n&&e.aspectRatio){var r=e.aspectRatio;e.aspectRatio=r,t.emit("aspectRatioReset")}}})}(n,this),function(t,e){var n=t.option,r=t.notice,i=t.template.$video;z(e,"getScreenshotDataURL",{value:function(){try{var t=document.createElement("canvas");return t.width=i.videoWidth,t.height=i.videoHeight,t.getContext("2d").drawImage(i,0,0),t.toDataURL("image/png")}catch(t){throw r.show=t,t}}}),z(e,"getScreenshotBlobUrl",{value:function(){return new Promise((function(t,e){try{var n=document.createElement("canvas");n.width=i.videoWidth,n.height=i.videoHeight,n.getContext("2d").drawImage(i,0,0),n.toBlob((function(e){t(URL.createObjectURL(e))}))}catch(t){r.show=t,e(t)}}))}}),z(e,"screenshot",{value:function(){var r=e.getScreenshotDataURL();r&&(T(r,"".concat(n.title||"artplayer","_").concat(_(i.currentTime),".png")),t.emit("screenshot",r))}})}(n,this),function(t,e){var n=t.template.$player;z(e,"fullscreen",{get:function(){return nt.isFullscreen},set:function(r){e.fullscreenWeb&&(e.fullscreenWeb=!1),r?nt.request(n).then((function(){h(n,"art-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenChange",!0)})):nt.exit().then((function(){y(n,"art-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenChange",!1)}))}}),z(e,"fullscreenToggle",{set:function(t){t&&(e.fullscreen=!e.fullscreen)}})}(n,this),function(t,e){var n=t.template.$player;z(e,"fullscreenWeb",{get:function(){return v(n,"art-web-fullscreen")},set:function(r){e.fullscreen&&(e.fullscreen=!1),r?(h(n,"art-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWebChange",!0)):(y(n,"art-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWebChange",!1))}}),z(e,"fullscreenWebToggle",{set:function(t){t&&(e.fullscreenWeb=!e.fullscreenWeb)}})}(n,this),rt(n,this),function(t,e){var n=t.template.$video;z(e,"loaded",{get:function(){return e.loadedTime/n.duration}}),z(e,"loadedTime",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1):0}})}(n,this),function(t,e){z(e,"played",{get:function(){return e.currentTime/e.duration}})}(0,this),function(t,e){var n=t.template.$video;z(e,"playing",{get:function(){return!!(n.currentTime>0&&!n.paused&&!n.ended&&n.readyState>2)}})}(n,this),function(t,e){var n=t.template,r=n.$container,i=n.$player,o=n.$video;z(e,"autoSize",{get:function(){return v(r,"art-auto-size")},set:function(n){if(n){var a=o.videoWidth,c=o.videoHeight,u=r.getBoundingClientRect(),s=u.width,l=u.height,f=a/c,p=s/l;if(h(r,"art-auto-size"),p>f){g(i,"width","".concat(l*f/s*100,"%")),g(i,"height","100%")}else{var d=s/f/l*100;g(i,"width","100%"),g(i,"height","".concat(d,"%"))}t.emit("autoSizeChange",{width:e.width,height:e.height})}else y(r,"art-auto-size"),g(i,"width",null),g(i,"height",null),t.emit("autoSizeRemove")}})}(n,this),function(t,e){z(e,"rect",{get:function(){return t.template.$player.getBoundingClientRect()}}),["bottom","height","left","right","top","width"].forEach((function(t){z(e,t,{get:function(){return e.rect[t]}})})),z(e,"x",{get:function(){return e.left+window.pageXOffset}}),z(e,"y",{get:function(){return e.top+window.pageYOffset}})}(n,this),function(t,e){var n=t.template.$player;z(e,"flip",{get:function(){return n.dataset.flip},set:function(e){if(e){var r=["normal","horizontal","vertical"];E(r.includes(e),"'flip' only accept ".concat(r.toString()," as parameters")),n.dataset.flip=e,t.emit("flipChange",e)}else delete n.dataset.flip,t.emit("flipRemove")}})}(n,this),F(n,this)};var ot=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=c(t)););return t},at=r((function(t){function e(n,r,i){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=e=Reflect.get:t.exports=e=function(t,e,n){var r=ot(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}},e(n,r,i||n)}t.exports=e})),ct=function(){function e(n){t(this,e),this.id=0,this.art=n,this.add=this.add.bind(this),this.name=this.constructor.name.toLowerCase()}return n(e,[{key:"add",value:function(t,e){var n=this,r="function"==typeof t?t(this.art):t;if(this.$parent&&!r.disable){this.id+=1;var i=r.name||"".concat(this.name).concat(this.id),o=document.createElement("div");o.classList.value="art-".concat(this.name," art-").concat(this.name,"-").concat(i),r.html&&m(o,r.html),r.style&&b(o,r.style),r.tooltip&&x(o,r.tooltip);var a=Array.from(this.$parent.children);o.dataset.index=r.index||this.id;var c=a.find((function(t){return Number(t.dataset.index)>=Number(o.dataset.index)}));c?c.insertAdjacentElement("beforebegin",o):m(this.$parent,o),r.click&&this.art.events.proxy(o,"click",(function(t){t.preventDefault(),r.click.call(n.art,n,t)})),r.mounted&&r.mounted(o,this,this.art),e&&e(o,this,this.art),this.art.emit("".concat(this.name,":add"),r)}}},{key:"show",get:function(){return v(this.art.template.$player,"art-".concat(this.name,"-show"))},set:function(t){var e=this.art.template.$player,n="art-".concat(this.name,"-show");t?h(e,n):y(e,n),this.art.emit("".concat(this.name,":toggle"),t)}},{key:"toggle",set:function(t){t&&(this.show=!this.show)}}]),e}();var ut=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};function st(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function lt(t){return function(e){return function(t){for(var e=1;e
'),mounted:function(t){var n=!1,i=p(".art-progress-loaded",t),c=p(".art-progress-played",t),u=p(".art-progress-highlight",t),s=p(".art-progress-indicator",t),l=p(".art-progress-tip",t);function f(t,e){"loaded"===t&&g(i,"width","".concat(100*e,"%")),"played"===t&&(g(c,"width","".concat(100*e,"%")),g(s,"left","calc(".concat(100*e,"% - ").concat(w(s,"width")/2,"px)")))}r.forEach((function(t){var e=U(t.time,0,a.duration)/a.duration*100;m(u,''))})),f("loaded",a.loaded),e.on("video:progress",(function(){f("loaded",a.loaded)})),e.on("video:timeupdate",(function(){f("played",a.played)})),e.on("video:ended",(function(){f("played",1)})),o(t,"mousemove",(function(n){g(l,"display","block"),n.composedPath().indexOf(u)>-1?function(n){var r=gt(e,n).width,i=n.target.dataset.text;l.innerHTML=i;var o=l.clientWidth;r<=o/2?g(l,"left",0):r>t.clientWidth-o/2?g(l,"left","".concat(t.clientWidth-o,"px")):g(l,"left","".concat(r-o/2,"px"))}(n):function(n){var r=gt(e,n),i=r.width,o=r.time;l.innerHTML=o;var a=l.clientWidth;i<=a/2?g(l,"left",0):i>t.clientWidth-a/2?g(l,"left","".concat(t.clientWidth-a,"px")):g(l,"left","".concat(i-a/2,"px"))}(n)})),o(t,"mouseout",(function(){g(l,"display","none")})),o(t,"click",(function(t){if(t.target!==s){var n=gt(e,t),r=n.second;f("played",n.percentage),a.seek=r}})),o(s,"mousedown",(function(){n=!0})),o(document,"mousemove",(function(t){if(n){var r=gt(e,t),i=r.second,o=r.percentage;h(s,"art-show-indicator"),f("played",o),a.seek=i}})),o(document,"mouseup",(function(){n&&(n=!1,y(s,"art-show-indicator"))}))}})}}function wt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ot(t){return function(e){return function(t){for(var e=1;e'),l=m(s,'
');function f(t){var e=s.getBoundingClientRect(),n=e.left,r=e.width,i=l.getBoundingClientRect().width;return U(t.pageX-n-i/2,0,r-i/2)/(r-i)}function p(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.7;if(i.muted||0===t)g(c,"display","none"),g(u,"display","flex"),g(l,"left","0");else{var e=((w(s,"width")||60)-w(l,"width"))*t;g(c,"display","flex"),g(u,"display","none"),g(l,"left","".concat(e,"px"))}}x(c,o.get("Mute")),g(u,"display","none"),p(i.volume),e.on("video:volumechange",(function(){p(i.volume)})),n(c,"click",(function(){i.muted=!0})),n(u,"click",(function(){i.muted=!1})),n(s,"click",(function(t){i.muted=!1,i.volume=f(t)})),n(l,"mousedown",(function(){a=!0})),n(document,"mousemove",(function(t){a&&(i.muted=!1,i.volume=f(t))})),n(document,"mouseup",(function(){a&&(a=!1)}))}})}}function St(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Et(t){return function(e){return function(t){for(var e=1;er.clientWidth-u/2?g(t,"left","".concat(r.clientWidth-u,"px")):g(t,"left","".concat(o-u/2,"px"))}(i))})),o(r,"mouseout",(function(){g(t,"display","none")}))}})}}function Ct(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Dt(t){return function(e){return function(t){for(var e=1;e'.concat(u.name,"")),l=n.map((function(t,e){return'
').concat(t.name,"
")})).join(""),f=m(t,'
'.concat(l,"
"));o(t,(function(){f.style.left="-".concat(w(f,"width")/2-t.clientWidth/2,"px")})),i(f,"click",(function(t){var e=Number(t.target.dataset.index),r=n[e],i=r.url,o=r.name;i&&o&&c!==e&&(a.switchQuality(i,o),s.innerText=o,c=e)}))}})}}var At=function(e){function r(e){var n;t(this,r),n=a(this,c(r).call(this,e));var i=e.option;return e.on("ready",(function(){n.add(bt({name:"progress",disable:i.isLive,position:"top",index:10})),n.add(Rt({name:"thumbnails",disable:!i.thumbnails.url||i.isLive,position:"top",index:20})),n.add(vt({name:"playAndPause",disable:!1,position:"left",index:10})),n.add(Pt({name:"volume",disable:!1,position:"left",index:20})),n.add(xt({name:"time",disable:i.isLive,position:"left",index:30})),n.add(Lt({name:"quality",disable:0===i.quality.length,position:"right",index:10})),n.add(Dt({name:"screenshot",disable:!i.screenshot,position:"right",index:20})),n.add(Ot({name:"subtitle",disable:!i.subtitle.url,position:"right",index:30})),n.add(Et({name:"setting",disable:!i.setting,position:"right",index:40})),n.add(ht({name:"pip",disable:!i.pip,position:"right",index:50})),n.add(pt({name:"fullscreenWeb",disable:!i.fullscreenWeb,position:"right",index:60})),n.add(lt({name:"fullscreen",disable:!i.fullscreen,position:"right",index:70})),i.controls.forEach((function(t){n.add(t)}))})),n}return s(r,e),n(r,[{key:"add",value:function(t,e){var n=this,i="function"==typeof t?t(this.art):t;E(["top","left","right"].includes(i.position),"Control option.position must one of 'top', 'left', 'right'");var o=this.art.template,a=o.$progress,u=o.$controlsLeft,s=o.$controlsRight;switch(i.position){case"top":this.$parent=a;break;case"left":this.$parent=u;break;case"right":this.$parent=s}at(c(r.prototype),"add",this).call(this,i,(function(t){i.disable||"top"===i.position||t.firstElementChild&&"I"===t.firstElementChild.tagName||h(t,"art-control-onlyText"),e&&e(t,n,n.art)}))}}]),r}(ct);function Mt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function qt(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e0.50.75').concat(n.get("Normal"),'1.251.52.0'),click:function(t,e){var n=e.target.dataset.rate;n&&(r.playbackRate=Number(n),t.show=!1)},mounted:function(t){e.on("playbackRateChange",(function(e){var n=d("span",t).find((function(t){return Number(t.dataset.rate)===e}));n&&j(n,"art-current")}))}})}}function zt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Wt(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e').concat(n.get("Default"),'4:316:9'),click:function(t,e){var n=e.target.dataset.ratio;n&&(r.aspectRatio=n,t.show=!1)},mounted:function(t){e.on("aspectRatioChange",(function(e){var n=d("span",t).find((function(t){return t.dataset.ratio===e}));n&&j(n,"art-current")}))}})}}function Vt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ft(t){return function(e){return function(t){for(var e=1;eArtPlayer 3.2.5'})}function Nt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function It(t){return function(e){return function(t){for(var e=1;ec+a&&(h=a-d),n+p>l+o&&(y=o-p),b(s,{top:"".concat(y,"px"),left:"".concat(h,"px")})})),l(u,"click",(function(t){t.composedPath().includes(s)||(r.show=!1)})),e.on("blur",(function(){r.show=!1}))})),r}return s(n,e),n}(ct),_t=function(e){function n(e){var r;t(this,n),r=a(this,c(n).call(this,e));var i=e.template,o=i.$infoPanel,u=i.$infoClose,s=i.$video;(0,e.events.proxy)(u,"click",(function(){r.show=!1}));var l=null,f=d("[data-video]",o);return e.on("destroy",(function(){clearTimeout(l)})),e.on("info:toggle",(function(t){clearTimeout(l),t&&function t(){f.forEach((function(t){var e=s[t.dataset.video];t.innerText="number"==typeof e?e.toFixed(2):e})),l=setTimeout((function(){t()}),1e3)}()})),r}return s(n,e),n}(ct),Xt=function(e){function r(e){var n;t(this,r),n=a(this,c(r).call(this,e));var i=e.events.proxy,u=e.option.subtitle;return b(e.template.$subtitle,u.style),i(n.textTrack,"cuechange",n.update.bind(o(n))),u.url&&n.init(u.url),n}return s(r,e),n(r,[{key:"update",value:function(){var t=this.art.template.$subtitle;t.innerHTML="",this.activeCue&&(t.innerHTML=this.activeCue.text.split(/\r?\n/).map((function(t){return"

".concat(t,"

")})).join(""),this.art.emit("subtitle:update",this.activeCue.text))}},{key:"switch",value:function(t,e,n){var r=this,i=this.art,o=i.i18n,a=i.notice;return this.init(t,n).then((function(t){return e&&(a.show="".concat(o.get("Switch subtitle"),": ").concat(e)),r.art.emit("subtitle:switch",t),t}))}},{key:"init",value:function(t,e){var n=this,r=this.art,i=r.notice,o=r.template,a=o.$subtitle,c=o.$track;return fetch(t).then((function(t){return t.text()})).then((function(r){switch(n.art.emit("subtitle:load",t),e||D(t)){case"srt":return R($(r));case"ass":return R(C(r));case"vtt":return R(r);default:return t}})).then((function(t){return a.innerHTML="",n.url===t?t:(URL.revokeObjectURL(n.url),c.src=t,t)})).catch((function(t){throw i.show=t,n.art.emit("subtitle:err",t),t}))}},{key:"url",get:function(){return this.art.template.$track.src}},{key:"textTrack",get:function(){return this.art.template.$video.textTracks[0]}},{key:"activeCue",get:function(){return this.textTrack.activeCues[0]}}]),r}(ct);var Zt=function(){function e(n){var r=this;t(this,e),this.destroyEvents=[],this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),this.loadImg=this.loadImg.bind(this),n.whitelist.state&&n.on("ready",(function(){!function(t,e){var n=t.template.$player;e.proxy(document,["click","contextmenu"],(function(e){e.composedPath().indexOf(n)>-1?(t.isFocus=!0,t.emit("focus")):(t.isFocus=!1,t.emit("blur"))}))}(n,r),function(t,e){var n=t.template.$player;e.hover(n,(function(){h(n,"art-hover"),t.emit("hoverenter")}),(function(){y(n,"art-hover"),t.emit("hoverleave")}))}(n,r),function(t,e){var n=t.template,r=n.$player,i=n.$video,o=t.player,a=t.controls,c=N((function(){h(r,"art-hide-cursor"),y(r,"art-hover"),a.show=!1}),3e3);t.on("hoverleave",(function(){o.playing&&c()})),e.proxy(r,"mousemove",(function(e){c.clearTimeout(),y(r,"art-hide-cursor"),a.show=!0,!o.pip&&o.playing&&e.target===i&&c(),t.emit("mousemove")}))}(n,r),function(t,e){var n=t.option,r=t.player,i=t.template.$player,o=document.createElement("object");o.setAttribute("aria-hidden","true"),o.setAttribute("tabindex",-1),o.type="text/html",o.data="about:blank";var a=r.width,c=r.height,u=I((function(){r.width===a&&r.height===c||(a=r.width,c=r.height,n.autoSize&&(r.fullscreen||r.fullscreenWeb||r.pip?r.autoSize=!1:r.autoSize=!0),r.aspectRatioReset=!0,t.emit("resize",{width:r.width,height:r.height}))}),500);e.proxy(o,"load",(function(){e.proxy(o.contentDocument.defaultView,"resize",u)})),i.appendChild(o)}(n,r)}))}return n(e,[{key:"proxy",value:function(t,e,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(Array.isArray(e))return e.map((function(e){return r.proxy(t,e,n,i)}));t.addEventListener(e,n,i);var o=function(){return t.removeEventListener(e,n,i)};return this.destroyEvents.push(o),o}},{key:"hover",value:function(t,e,n){e&&this.proxy(t,"mouseenter",e),n&&this.proxy(t,"mouseleave",n)}},{key:"loadImg",value:function(t){var e=this;return new Promise((function(n,r){var i;if(t instanceof HTMLImageElement)i=t;else{if("string"!=typeof t)return r(t);(i=new Image).src=t}return i.complete?n(i):(e.proxy(i,"load",(function(){return n(i)})),e.proxy(i,"error",(function(){return r(i)})),t)}))}},{key:"destroy",value:function(){this.destroyEvents.forEach((function(t){return t()}))}}]),e}(),Yt=function(){function e(n){var r=this;t(this,e),this.keys={};var i=n.option,o=n.player,a=n.events.proxy;i.hotkey&&n.on("ready",(function(){r.add(27,(function(){o.fullscreenWeb&&(o.fullscreenWeb=!1)})),r.add(32,(function(){o.toggle=!0})),r.add(37,(function(){o.seek=o.currentTime-5})),r.add(38,(function(){o.volume+=.1})),r.add(39,(function(){o.seek=o.currentTime+5})),r.add(40,(function(){o.volume-=.1})),a(window,"keydown",(function(t){if(n.isFocus){var e=document.activeElement.tagName.toUpperCase(),i=document.activeElement.getAttribute("contenteditable");if("INPUT"!==e&&"TEXTAREA"!==e&&""!==i&&"true"!==i){var o=r.keys[t.keyCode];o&&(t.preventDefault(),o.forEach((function(t){return t()})),n.emit("hotkey",t))}}}))}))}return n(e,[{key:"add",value:function(t,e){this.keys[t]?this.keys[t].push(e):this.keys[t]=[e]}}]),e}(),Jt=function(e){function n(e){var r;return t(this,n),(r=a(this,c(n).call(this,e))).$parent=e.template.$layer,e.on("ready",(function(){e.option.layers.forEach((function(t){r.add(t)}))})),r}return s(n,e),n}(ct),Gt=function(e){function n(e){var r;return t(this,n),r=a(this,c(n).call(this,e)),m(e.template.$loading,e.icons.loading),r}return s(n,e),n}(ct),Qt=function(){function e(n){t(this,e),this.art=n,this.time=2e3,this.timer=null}return n(e,[{key:"show",set:function(t){var e=this.art.template,n=e.$player,r=e.$noticeInner;r.innerText=t instanceof Error?t.message.trim():t,h(n,"art-notice-show"),clearTimeout(this.timer),this.timer=setTimeout((function(){r.innerText="",y(n,"art-notice-show")}),this.time)}}]),e}(),Kt=function(e){function n(e){var r;return t(this,n),r=a(this,c(n).call(this,e)),m(e.template.$state,e.icons.state),r}return s(n,e),n}(ct);function te(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}var ee=function e(n){var r=this;t(this,e);var i=function(t){for(var e=1;e',state:'',play:'',pause:'',volume:'',volumeClose:'',subtitle:'',screenshot:'\t',setting:'',fullscreen:'\t\t\t\t',fullscreenWeb:'\t',pip:''},n.option.icons);Object.keys(i).forEach((function(t){var e=document.createElement("i");e.classList.add("art-icon"),e.classList.add("art-icon-".concat(t)),m(e,i[t]),r[t]=e}))};function ne(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function re(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e'.concat(n.get("Flip"),'
"),click:function(t,e){var n=e.target.dataset.value;n&&(r.flip=n)},mounted:function(t){e.on("flipChange",(function(e){var n=d("button",t).find((function(t){return t.dataset.value===e}));n&&j(n.parentElement,"current")}))}})}}function ie(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function oe(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e'.concat(n.get("Aspect ratio"),'
'),click:function(t,e){var n=e.target.dataset.value;n&&(r.aspectRatio=n)},mounted:function(t){e.on("aspectRatioChange",(function(e){var n=d("button",t).find((function(t){return t.dataset.value===e}));n&&j(n.parentElement,"current")}))}})}}function ae(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function ce(t){return function(e){var n=e.i18n,r=e.player,i=e.events.proxy;return function(t){for(var e=1;e'.concat(n.get("Play speed"),': 1.0x
'),mounted:function(t){var n=p(".art-setting-range input",t),o=p(".art-subtitle-value",t);i(n,"change",(function(){var t=n.value;o.innerText=t,r.playbackRate=Number(t)})),e.on("playbackRateChange",(function(t){n.value!==t&&(n.value=t,o.innerText=t)}))}})}}var ue=function(e){function n(e){var r;t(this,n),r=a(this,c(n).call(this,e));var i=e.option,o=e.template,u=o.$setting,s=o.$settingBody,l=e.events.proxy;return r.$parent=s,i.setting&&(e.on("ready",(function(){l(u,"click",(function(t){t.target===u&&(r.show=!1)})),r.add(re({disable:!i.flip,name:"flip"})),r.add(oe({disable:!i.aspectRatio,name:"aspectRatio"})),r.add(ce({disable:!i.playbackRate,name:"playbackRate"}))})),e.on("blur",(function(){r.show=!1}))),r}return s(n,e),n}(ct),se=function(){function e(){t(this,e),this.name="artplayer_settings"}return n(e,[{key:"get",value:function(t){var e=JSON.parse(localStorage.getItem(this.name))||{};return t?e[t]:{}}},{key:"set",value:function(t,e){var n=Object.assign({},this.get(),ut({},t,e));localStorage.setItem(this.name,JSON.stringify(n))}},{key:"del",value:function(t){var e=this.get();delete e[t],localStorage.setItem(this.name,JSON.stringify(e))}},{key:"clean",value:function(){localStorage.removeItem(this.name)}}]),e}();function le(t){var e=t.i18n,n=t.subtitle,r=t.events.proxy;return{title:"Subtitle",name:"subtitleOffset",index:20,html:'
'.concat(e.get("Subtitle offset time"),': 0s
'),mounted:function(e){var i=p(".art-setting-range input",e),o=p(".art-subtitle-value",e);r(i,"change",(function(){var e=i.value;o.innerText=e,t.plugins.subtitleOffset.offset(Number(e))})),t.on("subtitle:switch",(function(){i.value=0,o.innerText=0})),t.on("subtitleOffset",(function(t){n.update(),i.value!==t&&(i.value=t,o.innerText=t)}))}}}function fe(t){var e=t.constructor.utils.clamp,n=t.setting,r=t.notice,i=t.template,o=t.i18n,a=t.player;n.add(le);var c=[];return t.on("subtitle:switch",(function(){c=[]})),{name:"subtitleOffset",offset:function(n){if(i.$track&&i.$track.track){var u=Array.from(i.$track.track.cues),s=e(n,-5,5);u.forEach((function(t,n){c[n]||(c[n]={startTime:t.startTime,endTime:t.endTime}),t.startTime=e(c[n].startTime+s,0,a.duration),t.endTime=e(c[n].endTime+s,0,a.duration)})),r.show="".concat(o.get("Subtitle offset time"),": ").concat(n,"s"),t.emit("subtitleOffset",n)}else r.show="".concat(o.get("No subtitles found")),t.emit("subtitleOffset",0)}}}function pe(t){var e=t.events.proxy,n=t.template,r=t.player,i=t.option,o=t.setting,a=t.i18n;function c(e){if(e){var o=n.$video.canPlayType(e.type);if("maybe"===o||"probably"===o){var a=URL.createObjectURL(e);i.title=e.name,r.switchUrl(a,e.name),t.emit("localVideo",e)}else E(!1,"Playback of this file format is not supported")}}function u(t){var n=m(t,'');g(t,"position","relative"),b(n,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(n,"change",(function(){c(n.files[0])}))}return e(n.$player,"dragover",(function(t){t.preventDefault()})),e(n.$player,"drop",(function(t){t.preventDefault(),c(t.dataTransfer.files[0])})),t.on("ready",(function(){o.add({title:"Local Video",name:"localVideo",index:30,html:'
'.concat(a.get("Local Video"),'
').concat(a.get("Open"),'
'),mounted:function(e){var n=p(".art-upload-btn",e),r=p(".art-upload-value",e);t.on("localVideo",(function(t){r.textContent=t.name,r.title=t.name})),u(n)}})})),{name:"localVideo",attach:u}}function de(t){var e=t.events.proxy,n=t.subtitle,r=t.setting,i=t.i18n;function o(r){var i=m(r,'');g(r,"position","relative"),b(i,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(i,"change",(function(){!function(e){if(e){var r=D(e.name);if(["ass","vtt","srt"].includes(r)){var i=URL.createObjectURL(e);n.switch(i,e.name,r),t.emit("localSubtitle",e)}else E(!1,"Only supports subtitle files in .ass, .vtt and .srt format")}}(i.files[0])}))}return t.on("ready",(function(){r.add({title:"Local Subtitle",name:"localSubtitle",index:40,html:'
'.concat(i.get("Local Subtitle"),'
').concat(i.get("Open"),'
'),mounted:function(e){var n=p(".art-upload-btn",e),r=p(".art-upload-value",e);t.on("localSubtitle",(function(t){r.textContent=t.name,r.title=t.name})),o(n)}})})),{name:"localSubtitle",attach:o}}function he(t){var e=t.layers,n=t.player,r=t.option.theme;return e.add({name:"miniProgressBar",style:{display:"none",position:"absolute",left:0,right:0,bottom:0,height:"2px",background:r},mounted:function(e){t.on("control:toggle",(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*n.played,"%")}))}}),{name:"miniProgressBar"}}function ye(t){var e=1e4,n=0,r=0,i=0,o=null;function a(){n=0,r=0,i=0,cancelAnimationFrame(o),o=null}function c(){o||function a(){t.isDestroy||(o=requestAnimationFrame((function(){var o=Date.now();if(i){var c=o-i;r+=c,t.player.playing||(n+=c)}i=o,t.emit("networkMonitor",n/r),r>=e&&(n=0,r=0),a()})))}()}return t.on("play",c),t.on("pause",a),{name:"networkMonitor",reset:a,start:c,sample:function(t){e=t}}}var ve=function(){function e(n){var r=this;t(this,e),this.art=n,this.id=0;var i=n.option;i.subtitle.url&&i.subtitleOffset&&this.add(fe),!i.isLive&&i.miniProgressBar&&this.add(he),i.localVideo&&this.add(pe),i.localSubtitle&&this.add(de),i.networkMonitor&&this.add(ye),n.option.plugins.forEach((function(t){r.add(t)}))}return n(e,[{key:"add",value:function(t){this.id+=1;var e=t.call(this,this.art),n="";return E(!V(this,n=e&&e.name?e.name:t.name?t.name:"plugin".concat(this.id)),"Cannot add a plugin that already has the same name: ".concat(n)),Object.defineProperty(this,n,{value:e}),this.art.emit("plugin:add",t),this}}]),e}(),me=function e(n){t(this,e);var r=n.option,i=n.events.proxy,o=n.template.$video;J.events.forEach((function(t){i(o,t,(function(t){n.emit("video:".concat(t.type),t)}))})),Object.keys(r.moreVideoAttr).forEach((function(t){o[t]=r.moreVideoAttr[t]})),r.muted&&(o.muted=r.muted),r.volume&&(o.volume=U(r.volume,0,1)),r.poster&&(o.poster=r.poster),r.autoplay&&(o.autoplay=r.autoplay),o.controls=!0;var a=r.type||D(r.url),c=r.customType[a];a&&c?(c(o,r.url,n),n.emit("customType",a)):(o.src=r.url,n.emit("urlChange",o.src))},ge=0,be=function(e){function r(e){var n;return t(this,r),(n=a(this,c(r).call(this))).option=l(H(r.option,e),Y),n.isFocus=!1,n.isDestroy=!1,n.whitelist=new G(o(n)),n.template=new Q(o(n)),n.events=new Zt(o(n)),n.whitelist.state?(n.storage=new se(o(n)),n.icons=new ee(o(n)),n.i18n=new et(o(n)),n.notice=new Qt(o(n)),n.player=new it(o(n)),n.layers=new Jt(o(n)),n.controls=new At(o(n)),n.contextmenu=new Ut(o(n)),n.subtitle=new Xt(o(n)),n.info=new _t(o(n)),n.loading=new Gt(o(n)),n.hotkey=new Yt(o(n)),n.mask=new Kt(o(n)),n.setting=new ue(o(n)),n.plugins=new ve(o(n))):n.mobile=new me(o(n)),ge+=1,n.id=ge,r.instances.push(o(n)),n}return s(r,e),n(r,[{key:"destroy",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.events.destroy(),this.template.destroy(t),r.instances.splice(r.instances.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}],[{key:"version",get:function(){return"3.2.5"}},{key:"env",get:function(){return'"production"'}},{key:"config",get:function(){return J}},{key:"utils",get:function(){return X}},{key:"scheme",get:function(){return Y}},{key:"Emitter",get:function(){return f}},{key:"validator",get:function(){return l}},{key:"kindOf",get:function(){return l.kindOf}},{key:"option",get:function(){return{container:"#artplayer",url:"",poster:"",title:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,loop:!1,flip:!1,playbackRate:!1,aspectRatio:!1,screenshot:!1,setting:!1,hotkey:!0,pip:!1,mutex:!0,fullscreen:!1,fullscreenWeb:!1,subtitleOffset:!1,miniProgressBar:!1,localVideo:!1,localSubtitle:!1,autoPip:!1,networkMonitor:!1,layers:[],contextmenu:[],quality:[],controls:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,width:160,height:90,column:10},subtitle:{url:"",style:{}},moreVideoAttr:{controls:!1,preload:"metadata"},icons:{},customType:{},lang:navigator.language.toLowerCase()}}}]),r}(f);return Object.defineProperty(be,"instances",{value:[]}),console.log("%c ArtPlayer %c 3.2.5 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),be})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Artplayer=e()}(this,(function(){"use strict";var t=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function e(t,e){for(var n=0;n1?n-1:0),i=1;i1&&void 0!==arguments[1]?arguments[1]:document).querySelector(t)}function d(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(e.querySelectorAll(t))}function h(t,e){return t.classList.add(e)}function y(t,e){return t.classList.remove(e)}function v(t,e){return t.classList.contains(e)}function m(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function g(t,e,n){return t.style[e]=n,t}function b(t,e){return Object.keys(e).forEach((function(n){g(t,n,e[n])})),t}function w(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=window.getComputedStyle(t,null).getPropertyValue(e);return n?parseFloat(r):r}function O(t){return Array.from(t.parentElement.children).filter((function(e){return e!==t}))}function j(t,e){O(t).forEach((function(t){return y(t,e)})),h(t,e)}function x(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"up";t.setAttribute("aria-label",e),t.setAttribute("data-balloon-pos",n)}var k=function(t){return-1!==Function.toString.call(t).indexOf("[native code]")},P=r((function(t){function e(n,r,i){return!function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}()?t.exports=e=function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&s(i,n.prototype),i}:t.exports=e=Reflect.construct,e.apply(null,arguments)}t.exports=e})),S=function(e){function n(e,r){var i;return t(this,n),i=a(this,c(n).call(this,e)),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(o(i),r||i.constructor),i.name="ArtPlayerError",i}return u(n,e),n}(r((function(t){function e(n){var r="function"==typeof Map?new Map:void 0;return t.exports=e=function(t){if(null===t||!k(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,e)}function e(){return P(t,arguments,c(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),s(e,t)},e(n)}t.exports=e}))(Error));function E(t,e){if(!t)throw new S(e);return t}function $(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 R(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function C(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 n(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(/[:.]/).map((function(t,e,n){if(e===n.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===n.length-1?".".concat(t):":".concat(t)})).join("")}return"WEBVTT\n\n".concat(t.split(/\r?\n/).map((function(t){var r=t.match(e);return r?{start:n(r[1].trim()),end:n(r[2].trim()),text:r[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 D(t){return t.includes("?")?D(t.split("?")[0]):t.includes("#")?D(t.split("#")[0]):t.trim().toLowerCase().split(".").pop()}function T(t,e){var n=document.createElement("a");n.style.display="none",n.href=t,n.download=e,document.body.appendChild(n),n.click(),document.body.removeChild(n)}var L=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e1?e-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(e){return setTimeout(e,t)}))}function N(t,e,n){var r;function i(){for(var i=arguments.length,o=new Array(i),a=0;a0?[e,n,r]:[n,r]).map((function(t){return t<10?"0".concat(t):String(t)})).join(":")}var X=Object.freeze({__proto__:null,query:p,queryAll:d,addClass:h,removeClass:y,hasClass:v,append:m,remove:function(t){return t.parentNode.removeChild(t)},setStyle:g,setStyles:b,getStyle:w,sublings:O,inverseClass:j,tooltip:x,ArtPlayerError:S,errorHandle:E,srtToVtt:$,vttToBlob:R,assToVtt:C,getExt:D,downloadFile:T,def:z,has:V,proxyPropertys:F,mergeDeep:H,sleep:B,debounce:N,throttle:I,clamp:U,secondToTime:_});function Z(t,e,n){return E("string"===e||t instanceof Element,"".concat(n.join(".")," require 'string' or 'Element' type"))}var Y={container:Z,url:"string",poster:"string",title:"string",theme:"string",lang:"string",volume:"number",isLive:"boolean",muted:"boolean",autoplay:"boolean",autoSize:"boolean",loop:"boolean",flip:"boolean",playbackRate:"boolean",aspectRatio:"boolean",screenshot:"boolean",setting:"boolean",hotkey:"boolean",pip:"boolean",mutex:"boolean",fullscreen:"boolean",fullscreenWeb:"boolean",subtitleOffset:"boolean",miniProgressBar:"boolean",localVideo:"boolean",localSubtitle:"boolean",networkMonitor:"boolean",plugins:["function"],whitelist:["string|function|regexp"],layers:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:Z,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined"}],contextmenu:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:Z,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined"}],quality:[{default:"boolean|undefined",name:"string",url:"string"}],controls:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:Z,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined",position:function(t,e,n){var r=["top","left","right"];return E(r.includes(t),"".concat(n.join(".")," only accept ").concat(r.toString()," as parameters"))}}],highlight:[{time:"number",text:"string"}],thumbnails:{url:"string",number:"number",width:"number",height:"number",column:"number"},subtitle:{url:"string",style:"object"},moreVideoAttr:"object",icons:"object",customType:"object"},J={propertys:["audioTracks","autoplay","buffered","controller","controls","crossOrigin","currentSrc","currentTime","defaultMuted","defaultPlaybackRate","duration","ended","error","loop","mediaGroup","muted","networkState","paused","playbackRate","played","preload","readyState","seekable","seeking","src","startDate","textTracks","videoTracks","volume"],methods:["addTextTrack","canPlayType","load","play","pause"],events:["abort","canplay","canplaythrough","durationchange","emptied","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"]},G=function e(n){var r=this;t(this,e);var i=n.constructor.kindOf,o=n.option.whitelist;this.ua=navigator.userAgent,this.isMobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(this.ua),this.state=!this.isMobile||o.some((function(t){switch(i(t)){case"string":return r.ua.indexOf(t)>-1;case"function":return t(r.ua);case"regexp":return t.test(r.ua);default:return!1}}))},Q=function(){function e(n){var r=this;t(this,e),this.art=n,n.option.container instanceof Element?this.$container=n.option.container:(this.$container=p(n.option.container),E(this.$container,"No container element found by ".concat(n.option.container))),E(n.constructor.instances.every((function(t){return t.template.$container!==r.$container})),"Cannot mount multiple instances on the same dom element"),E(this.$container.clientWidth&&this.$container.clientHeight,"The width and height of the container cannot be 0"),n.whitelist.state?this.desktop():this.mobile()}return n(e,[{key:"query",value:function(t){return p(t,this.$container)}},{key:"desktop",value:function(){this.$container.innerHTML='
Player version:
3.2.5
Video url:
Video volume:
Video time:
Video duration:
Video resolution:
x
[x]
xD7
'),this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video"),this.$track=this.query(".art-video track"),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.$pipHeader=this.query(".art-pip-header"),this.$pipTitle=this.query(".art-pip-title"),this.$pipClose=this.query(".art-pip-close"),this.$contextmenu=this.query(".art-contextmenus")}},{key:"mobile",value:function(){this.$container.innerHTML='
',this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video")}},{key:"destroy",value:function(t){t?this.$container.innerHTML="":h(this.$player,"art-destroy")}}]),e}(),K={"Video info":"视频统计信息",Close:"关闭","Video load failed":"视频加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音",Flip:"视频翻转",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":"迷你播放器","Exit mini player":"退出迷你播放器","Local Subtitle":"本地字幕","Local Video":"本地视频","Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},tt={"Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"影片翻轉",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":"迷你播放器","Exit mini player":"退出迷你播放器","Local Subtitle":"本地字幕","Local Video":"本地視頻","Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"},et=function(){function e(n){t(this,e),this.art=n,this.languages={"zh-cn":K,"zh-tw":tt},this.init()}return n(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=H(this.languages,t),this.init()}}]),e}();var nt=r((function(t){!function(){var e="undefined"!=typeof window&&void 0!==window.document?window.document:{},n=t.exports,r=function(){for(var t,n=[["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"]],r=0,i=n.length,o={};rh){var y=h*l/u;g(r,"width","".concat(100*y,"%")),g(r,"height","100%"),g(r,"padding","0 ".concat((f-f*y)/2,"px"))}else{var v=u/h/l;g(r,"width","100%"),g(r,"height","".concat(100*v,"%")),g(r,"padding","".concat((p-p*v)/2,"px 0"))}}i.dataset.aspectRatio=n,a.show="".concat(o.get("Aspect ratio"),": ").concat("default"===n?o.get("Default"):n),t.emit("aspectRatioChange",n)}else e.aspectRatio&&(g(r,"width",null),g(r,"height",null),g(r,"padding",null),delete i.dataset.aspectRatio,t.emit("aspectRatioRemove"))}}),z(e,"aspectRatioReset",{set:function(n){if(n&&e.aspectRatio){var r=e.aspectRatio;e.aspectRatio=r,t.emit("aspectRatioReset")}}})}(n,this),function(t,e){var n=t.option,r=t.notice,i=t.template.$video;z(e,"getScreenshotDataURL",{value:function(){try{var t=document.createElement("canvas");return t.width=i.videoWidth,t.height=i.videoHeight,t.getContext("2d").drawImage(i,0,0),t.toDataURL("image/png")}catch(t){throw r.show=t,t}}}),z(e,"getScreenshotBlobUrl",{value:function(){return new Promise((function(t,e){try{var n=document.createElement("canvas");n.width=i.videoWidth,n.height=i.videoHeight,n.getContext("2d").drawImage(i,0,0),n.toBlob((function(e){t(URL.createObjectURL(e))}))}catch(t){r.show=t,e(t)}}))}}),z(e,"screenshot",{value:function(){var r=e.getScreenshotDataURL();r&&(T(r,"".concat(n.title||"artplayer","_").concat(_(i.currentTime),".png")),t.emit("screenshot",r))}})}(n,this),function(t,e){var n=t.template.$player;z(e,"fullscreen",{get:function(){return nt.isFullscreen},set:function(r){e.fullscreenWeb&&(e.fullscreenWeb=!1),r?nt.request(n).then((function(){h(n,"art-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenChange",!0)})):nt.exit().then((function(){y(n,"art-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenChange",!1)}))}}),z(e,"fullscreenToggle",{set:function(t){t&&(e.fullscreen=!e.fullscreen)}})}(n,this),function(t,e){var n=t.template.$player;z(e,"fullscreenWeb",{get:function(){return v(n,"art-web-fullscreen")},set:function(r){e.fullscreen&&(e.fullscreen=!1),r?(h(n,"art-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWebChange",!0)):(y(n,"art-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWebChange",!1))}}),z(e,"fullscreenWebToggle",{set:function(t){t&&(e.fullscreenWeb=!e.fullscreenWeb)}})}(n,this),rt(n,this),function(t,e){var n=t.template.$video;z(e,"loaded",{get:function(){return e.loadedTime/n.duration}}),z(e,"loadedTime",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1):0}})}(n,this),function(t,e){z(e,"played",{get:function(){return e.currentTime/e.duration}})}(0,this),function(t,e){var n=t.template.$video;z(e,"playing",{get:function(){return!!(n.currentTime>0&&!n.paused&&!n.ended&&n.readyState>2)}})}(n,this),function(t,e){var n=t.template,r=n.$container,i=n.$player,o=n.$video;z(e,"autoSize",{get:function(){return v(r,"art-auto-size")},set:function(n){if(n){var a=o.videoWidth,c=o.videoHeight,s=r.getBoundingClientRect(),u=s.width,l=s.height,f=a/c,p=u/l;if(h(r,"art-auto-size"),p>f){g(i,"width","".concat(l*f/u*100,"%")),g(i,"height","100%")}else{var d=u/f/l*100;g(i,"width","100%"),g(i,"height","".concat(d,"%"))}t.emit("autoSizeChange",{width:e.width,height:e.height})}else y(r,"art-auto-size"),g(i,"width",null),g(i,"height",null),t.emit("autoSizeRemove")}})}(n,this),function(t,e){z(e,"rect",{get:function(){return t.template.$player.getBoundingClientRect()}}),["bottom","height","left","right","top","width"].forEach((function(t){z(e,t,{get:function(){return e.rect[t]}})})),z(e,"x",{get:function(){return e.left+window.pageXOffset}}),z(e,"y",{get:function(){return e.top+window.pageYOffset}})}(n,this),function(t,e){var n=t.template.$player;z(e,"flip",{get:function(){return n.dataset.flip},set:function(e){if(e){var r=["normal","horizontal","vertical"];E(r.includes(e),"'flip' only accept ".concat(r.toString()," as parameters")),n.dataset.flip=e,t.emit("flipChange",e)}else delete n.dataset.flip,t.emit("flipRemove")}})}(n,this),F(n,this)};var ot=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=c(t)););return t},at=r((function(t){function e(n,r,i){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=e=Reflect.get:t.exports=e=function(t,e,n){var r=ot(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}},e(n,r,i||n)}t.exports=e})),ct=function(){function e(n){t(this,e),this.id=0,this.art=n,this.add=this.add.bind(this),this.name=this.constructor.name.toLowerCase()}return n(e,[{key:"add",value:function(t,e){var n=this,r="function"==typeof t?t(this.art):t;if(this.$parent&&!r.disable){this.id+=1;var i=r.name||"".concat(this.name).concat(this.id),o=document.createElement("div");o.classList.value="art-".concat(this.name," art-").concat(this.name,"-").concat(i),r.html&&m(o,r.html),r.style&&b(o,r.style),r.tooltip&&x(o,r.tooltip);var a=Array.from(this.$parent.children);o.dataset.index=r.index||this.id;var c=a.find((function(t){return Number(t.dataset.index)>=Number(o.dataset.index)}));c?c.insertAdjacentElement("beforebegin",o):m(this.$parent,o),r.click&&this.art.events.proxy(o,"click",(function(t){t.preventDefault(),r.click.call(n.art,n,t)})),r.mounted&&r.mounted(o,this,this.art),e&&e(o,this,this.art),this.art.emit("".concat(this.name,":add"),r)}}},{key:"show",get:function(){return v(this.art.template.$player,"art-".concat(this.name,"-show"))},set:function(t){var e=this.art.template.$player,n="art-".concat(this.name,"-show");t?h(e,n):y(e,n),this.art.emit("".concat(this.name,":toggle"),t)}},{key:"toggle",set:function(t){t&&(this.show=!this.show)}}]),e}();var st=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};function ut(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function lt(t){return function(e){return function(t){for(var e=1;e
'),mounted:function(t){var n=!1,i=p(".art-progress-loaded",t),c=p(".art-progress-played",t),s=p(".art-progress-highlight",t),u=p(".art-progress-indicator",t),l=p(".art-progress-tip",t);function f(t,e){"loaded"===t&&g(i,"width","".concat(100*e,"%")),"played"===t&&(g(c,"width","".concat(100*e,"%")),g(u,"left","calc(".concat(100*e,"% - ").concat(w(u,"width")/2,"px)")))}r.forEach((function(t){var e=U(t.time,0,a.duration)/a.duration*100;m(s,''))})),f("loaded",a.loaded),e.on("video:progress",(function(){f("loaded",a.loaded)})),e.on("video:timeupdate",(function(){f("played",a.played)})),e.on("video:ended",(function(){f("played",1)})),o(t,"mousemove",(function(n){g(l,"display","block"),n.composedPath().indexOf(s)>-1?function(n){var r=gt(e,n).width,i=n.target.dataset.text;l.innerHTML=i;var o=l.clientWidth;r<=o/2?g(l,"left",0):r>t.clientWidth-o/2?g(l,"left","".concat(t.clientWidth-o,"px")):g(l,"left","".concat(r-o/2,"px"))}(n):function(n){var r=gt(e,n),i=r.width,o=r.time;l.innerHTML=o;var a=l.clientWidth;i<=a/2?g(l,"left",0):i>t.clientWidth-a/2?g(l,"left","".concat(t.clientWidth-a,"px")):g(l,"left","".concat(i-a/2,"px"))}(n)})),o(t,"mouseout",(function(){g(l,"display","none")})),o(t,"click",(function(t){if(t.target!==u){var n=gt(e,t),r=n.second;f("played",n.percentage),a.seek=r}})),o(u,"mousedown",(function(){n=!0})),o(document,"mousemove",(function(t){if(n){var r=gt(e,t),i=r.second,o=r.percentage;h(u,"art-show-indicator"),f("played",o),a.seek=i}})),o(document,"mouseup",(function(){n&&(n=!1,y(u,"art-show-indicator"))}))}})}}function wt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ot(t){return function(e){return function(t){for(var e=1;e'),l=m(u,'
');function f(t){var e=u.getBoundingClientRect(),n=e.left,r=e.width,i=l.getBoundingClientRect().width;return U(t.pageX-n-i/2,0,r-i/2)/(r-i)}function p(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.7;if(i.muted||0===t)g(c,"display","none"),g(s,"display","flex"),g(l,"left","0");else{var e=((w(u,"width")||60)-w(l,"width"))*t;g(c,"display","flex"),g(s,"display","none"),g(l,"left","".concat(e,"px"))}}x(c,o.get("Mute")),g(s,"display","none"),p(i.volume),e.on("video:volumechange",(function(){p(i.volume)})),n(c,"click",(function(){i.muted=!0})),n(s,"click",(function(){i.muted=!1})),n(u,"click",(function(t){i.muted=!1,i.volume=f(t)})),n(l,"mousedown",(function(){a=!0})),n(document,"mousemove",(function(t){a&&(i.muted=!1,i.volume=f(t))})),n(document,"mouseup",(function(){a&&(a=!1)}))}})}}function St(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Et(t){return function(e){return function(t){for(var e=1;er.clientWidth-s/2?g(t,"left","".concat(r.clientWidth-s,"px")):g(t,"left","".concat(o-s/2,"px"))}(i))})),o(r,"mouseout",(function(){g(t,"display","none")}))}})}}function Ct(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Dt(t){return function(e){return function(t){for(var e=1;e'.concat(s.name,"")),l=n.map((function(t,e){return'
').concat(t.name,"
")})).join(""),f=m(t,'
'.concat(l,"
"));o(t,(function(){f.style.left="-".concat(w(f,"width")/2-t.clientWidth/2,"px")})),i(f,"click",(function(t){var e=Number(t.target.dataset.index),r=n[e],i=r.url,o=r.name;i&&o&&c!==e&&(a.switchQuality(i,o),u.innerText=o,c=e)}))}})}}var At=function(e){function r(e){var n;t(this,r),n=a(this,c(r).call(this,e));var i=e.option;return e.on("ready",(function(){n.add(bt({name:"progress",disable:i.isLive,position:"top",index:10})),n.add(Rt({name:"thumbnails",disable:!i.thumbnails.url||i.isLive,position:"top",index:20})),n.add(vt({name:"playAndPause",disable:!1,position:"left",index:10})),n.add(Pt({name:"volume",disable:!1,position:"left",index:20})),n.add(xt({name:"time",disable:i.isLive,position:"left",index:30})),n.add(Lt({name:"quality",disable:0===i.quality.length,position:"right",index:10})),n.add(Dt({name:"screenshot",disable:!i.screenshot,position:"right",index:20})),n.add(Ot({name:"subtitle",disable:!i.subtitle.url,position:"right",index:30})),n.add(Et({name:"setting",disable:!i.setting,position:"right",index:40})),n.add(ht({name:"pip",disable:!i.pip,position:"right",index:50})),n.add(pt({name:"fullscreenWeb",disable:!i.fullscreenWeb,position:"right",index:60})),n.add(lt({name:"fullscreen",disable:!i.fullscreen,position:"right",index:70})),i.controls.forEach((function(t){n.add(t)}))})),n}return u(r,e),n(r,[{key:"add",value:function(t,e){var n=this,i="function"==typeof t?t(this.art):t;E(["top","left","right"].includes(i.position),"Control option.position must one of 'top', 'left', 'right'");var o=this.art.template,a=o.$progress,s=o.$controlsLeft,u=o.$controlsRight;switch(i.position){case"top":this.$parent=a;break;case"left":this.$parent=s;break;case"right":this.$parent=u}at(c(r.prototype),"add",this).call(this,i,(function(t){i.disable||"top"===i.position||t.firstElementChild&&"I"===t.firstElementChild.tagName||h(t,"art-control-onlyText"),e&&e(t,n,n.art)}))}}]),r}(ct);function Mt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function qt(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e0.50.75').concat(n.get("Normal"),'1.251.52.0'),click:function(t,e){var n=e.target.dataset.rate;n&&(r.playbackRate=Number(n),t.show=!1)},mounted:function(t){e.on("playbackRateChange",(function(e){var n=d("span",t).find((function(t){return Number(t.dataset.rate)===e}));n&&j(n,"art-current")}))}})}}function zt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Wt(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e').concat(n.get("Default"),'4:316:9'),click:function(t,e){var n=e.target.dataset.ratio;n&&(r.aspectRatio=n,t.show=!1)},mounted:function(t){e.on("aspectRatioChange",(function(e){var n=d("span",t).find((function(t){return t.dataset.ratio===e}));n&&j(n,"art-current")}))}})}}function Vt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ft(t){return function(e){return function(t){for(var e=1;eArtPlayer 3.2.5'})}function Nt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function It(t){return function(e){return function(t){for(var e=1;ec+a&&(h=a-d),n+p>l+o&&(y=o-p),b(u,{top:"".concat(y,"px"),left:"".concat(h,"px")})})),l(s,"click",(function(t){t.composedPath().includes(u)||(r.show=!1)})),e.on("blur",(function(){r.show=!1}))})),r}return u(n,e),n}(ct),_t=function(e){function n(e){var r;t(this,n),r=a(this,c(n).call(this,e));var i=e.template,o=i.$infoPanel,s=i.$infoClose,u=i.$video;(0,e.events.proxy)(s,"click",(function(){r.show=!1}));var l=null,f=d("[data-video]",o);return e.on("destroy",(function(){clearTimeout(l)})),e.on("info:toggle",(function(t){clearTimeout(l),t&&function t(){f.forEach((function(t){var e=u[t.dataset.video];t.innerText="number"==typeof e?e.toFixed(2):e})),l=setTimeout((function(){t()}),1e3)}()})),r}return u(n,e),n}(ct),Xt=function(e){function r(e){var n;t(this,r),n=a(this,c(r).call(this,e));var i=e.events.proxy,s=e.option.subtitle;return b(e.template.$subtitle,s.style),i(n.textTrack,"cuechange",n.update.bind(o(n))),s.url&&n.init(s.url),n}return u(r,e),n(r,[{key:"update",value:function(){var t=this.art.template.$subtitle;t.innerHTML="",this.activeCue&&(t.innerHTML=this.activeCue.text.split(/\r?\n/).map((function(t){return"

".concat(t,"

")})).join(""),this.art.emit("subtitle:update",this.activeCue.text))}},{key:"switch",value:function(t,e,n){var r=this,i=this.art,o=i.i18n,a=i.notice;return this.init(t,n).then((function(t){return e&&(a.show="".concat(o.get("Switch subtitle"),": ").concat(e)),r.art.emit("subtitle:switch",t),t}))}},{key:"init",value:function(t,e){var n=this,r=this.art,i=r.notice,o=r.template,a=o.$subtitle,c=o.$track;return fetch(t).then((function(t){return t.text()})).then((function(r){switch(n.art.emit("subtitle:load",t),e||D(t)){case"srt":return R($(r));case"ass":return R(C(r));case"vtt":return R(r);default:return t}})).then((function(t){return a.innerHTML="",n.url===t?t:(URL.revokeObjectURL(n.url),c.src=t,t)})).catch((function(t){throw i.show=t,n.art.emit("subtitle:err",t),t}))}},{key:"url",get:function(){return this.art.template.$track.src}},{key:"textTrack",get:function(){return this.art.template.$video.textTracks[0]}},{key:"activeCue",get:function(){return this.textTrack.activeCues[0]}}]),r}(ct);var Zt=function(){function e(n){var r=this;t(this,e),this.destroyEvents=[],this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),this.loadImg=this.loadImg.bind(this),n.whitelist.state&&n.on("ready",(function(){!function(t,e){var n=t.template.$player;e.proxy(document,["click","contextmenu"],(function(e){e.composedPath().indexOf(n)>-1?(t.isFocus=!0,t.emit("focus")):(t.isFocus=!1,t.emit("blur"))}))}(n,r),function(t,e){var n=t.template.$player;e.hover(n,(function(){h(n,"art-hover"),t.emit("hoverenter")}),(function(){y(n,"art-hover"),t.emit("hoverleave")}))}(n,r),function(t,e){var n=t.template,r=n.$player,i=n.$video,o=t.player,a=t.controls,c=N((function(){h(r,"art-hide-cursor"),y(r,"art-hover"),a.show=!1}),3e3);t.on("hoverleave",(function(){o.playing&&c()})),e.proxy(r,"mousemove",(function(e){c.clearTimeout(),y(r,"art-hide-cursor"),a.show=!0,!o.pip&&o.playing&&e.target===i&&c(),t.emit("mousemove")}))}(n,r),function(t,e){var n=t.option,r=t.player,i=t.template.$player,o=document.createElement("object");o.setAttribute("aria-hidden","true"),o.setAttribute("tabindex",-1),o.type="text/html",o.data="about:blank";var a=r.width,c=r.height,s=I((function(){r.width===a&&r.height===c||(a=r.width,c=r.height,n.autoSize&&(r.fullscreen||r.fullscreenWeb||r.pip?r.autoSize=!1:r.autoSize=!0),r.aspectRatioReset=!0,t.emit("resize",{width:r.width,height:r.height}))}),500);e.proxy(o,"load",(function(){e.proxy(o.contentDocument.defaultView,"resize",s)})),i.appendChild(o)}(n,r)}))}return n(e,[{key:"proxy",value:function(t,e,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(Array.isArray(e))return e.map((function(e){return r.proxy(t,e,n,i)}));t.addEventListener(e,n,i);var o=function(){return t.removeEventListener(e,n,i)};return this.destroyEvents.push(o),o}},{key:"hover",value:function(t,e,n){e&&this.proxy(t,"mouseenter",e),n&&this.proxy(t,"mouseleave",n)}},{key:"loadImg",value:function(t){var e=this;return new Promise((function(n,r){var i;if(t instanceof HTMLImageElement)i=t;else{if("string"!=typeof t)return r(t);(i=new Image).src=t}return i.complete?n(i):(e.proxy(i,"load",(function(){return n(i)})),e.proxy(i,"error",(function(){return r(i)})),t)}))}},{key:"destroy",value:function(){this.destroyEvents.forEach((function(t){return t()}))}}]),e}(),Yt=function(){function e(n){var r=this;t(this,e),this.keys={};var i=n.option,o=n.player,a=n.events.proxy;i.hotkey&&n.on("ready",(function(){r.add(27,(function(){o.fullscreenWeb&&(o.fullscreenWeb=!1)})),r.add(32,(function(){o.toggle=!0})),r.add(37,(function(){o.seek=o.currentTime-5})),r.add(38,(function(){o.volume+=.1})),r.add(39,(function(){o.seek=o.currentTime+5})),r.add(40,(function(){o.volume-=.1})),a(window,"keydown",(function(t){if(n.isFocus){var e=document.activeElement.tagName.toUpperCase(),i=document.activeElement.getAttribute("contenteditable");if("INPUT"!==e&&"TEXTAREA"!==e&&""!==i&&"true"!==i){var o=r.keys[t.keyCode];o&&(t.preventDefault(),o.forEach((function(t){return t()})),n.emit("hotkey",t))}}}))}))}return n(e,[{key:"add",value:function(t,e){this.keys[t]?this.keys[t].push(e):this.keys[t]=[e]}}]),e}(),Jt=function(e){function n(e){var r;return t(this,n),(r=a(this,c(n).call(this,e))).$parent=e.template.$layer,e.on("ready",(function(){e.option.layers.forEach((function(t){r.add(t)}))})),r}return u(n,e),n}(ct),Gt=function(e){function n(e){var r;return t(this,n),r=a(this,c(n).call(this,e)),m(e.template.$loading,e.icons.loading),r}return u(n,e),n}(ct),Qt=function(){function e(n){t(this,e),this.art=n,this.time=2e3,this.timer=null}return n(e,[{key:"show",set:function(t){var e=this.art.template,n=e.$player,r=e.$noticeInner;r.innerText=t instanceof Error?t.message.trim():t,h(n,"art-notice-show"),clearTimeout(this.timer),this.timer=setTimeout((function(){r.innerText="",y(n,"art-notice-show")}),this.time)}}]),e}(),Kt=function(e){function n(e){var r;return t(this,n),r=a(this,c(n).call(this,e)),m(e.template.$state,e.icons.state),r}return u(n,e),n}(ct);function te(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}var ee=function e(n){var r=this;t(this,e);var i=function(t){for(var e=1;e',state:'',play:'',pause:'',volume:'',volumeClose:'',subtitle:'',screenshot:'\t',setting:'',fullscreen:'\t\t\t\t',fullscreenWeb:'\t',pip:''},n.option.icons);Object.keys(i).forEach((function(t){var e=document.createElement("i");e.classList.add("art-icon"),e.classList.add("art-icon-".concat(t)),m(e,i[t]),r[t]=e}))};function ne(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function re(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e'.concat(n.get("Flip"),'
"),click:function(t,e){var n=e.target.dataset.value;n&&(r.flip=n)},mounted:function(t){e.on("flipChange",(function(e){var n=d("button",t).find((function(t){return t.dataset.value===e}));n&&j(n.parentElement,"current")}))}})}}function ie(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function oe(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e'.concat(n.get("Aspect ratio"),'
'),click:function(t,e){var n=e.target.dataset.value;n&&(r.aspectRatio=n)},mounted:function(t){e.on("aspectRatioChange",(function(e){var n=d("button",t).find((function(t){return t.dataset.value===e}));n&&j(n.parentElement,"current")}))}})}}function ae(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function ce(t){return function(e){var n=e.i18n,r=e.player,i=e.events.proxy;return function(t){for(var e=1;e'.concat(n.get("Play speed"),': 1.0x
'),mounted:function(t){var n=p(".art-setting-range input",t),o=p(".art-subtitle-value",t);i(n,"change",(function(){var t=n.value;o.innerText=t,r.playbackRate=Number(t)})),e.on("playbackRateChange",(function(t){n.value!==t&&(n.value=t,o.innerText=t)}))}})}}var se=function(e){function n(e){var r;t(this,n),r=a(this,c(n).call(this,e));var i=e.option,o=e.template,s=o.$setting,u=o.$settingBody,l=e.events.proxy;return r.$parent=u,i.setting&&(e.on("ready",(function(){l(s,"click",(function(t){t.target===s&&(r.show=!1)})),r.add(re({disable:!i.flip,name:"flip"})),r.add(oe({disable:!i.aspectRatio,name:"aspectRatio"})),r.add(ce({disable:!i.playbackRate,name:"playbackRate"}))})),e.on("blur",(function(){r.show=!1}))),r}return u(n,e),n}(ct),ue=function(){function e(){t(this,e),this.name="artplayer_settings"}return n(e,[{key:"get",value:function(t){var e=JSON.parse(localStorage.getItem(this.name))||{};return t?e[t]:{}}},{key:"set",value:function(t,e){var n=Object.assign({},this.get(),st({},t,e));localStorage.setItem(this.name,JSON.stringify(n))}},{key:"del",value:function(t){var e=this.get();delete e[t],localStorage.setItem(this.name,JSON.stringify(e))}},{key:"clean",value:function(){localStorage.removeItem(this.name)}}]),e}();function le(t){var e=t.i18n,n=t.subtitle,r=t.events.proxy;return{title:"Subtitle",name:"subtitleOffset",index:20,html:'
'.concat(e.get("Subtitle offset time"),': 0s
'),mounted:function(e){var i=p(".art-setting-range input",e),o=p(".art-subtitle-value",e);r(i,"change",(function(){var e=i.value;o.innerText=e,t.plugins.subtitleOffset.offset(Number(e))})),t.on("subtitle:switch",(function(){i.value=0,o.innerText=0})),t.on("subtitleOffset",(function(t){n.update(),i.value!==t&&(i.value=t,o.innerText=t)}))}}}function fe(t){var e=t.constructor.utils.clamp,n=t.setting,r=t.notice,i=t.template,o=t.i18n,a=t.player;n.add(le);var c=[];return t.on("subtitle:switch",(function(){c=[]})),{name:"subtitleOffset",offset:function(n){if(i.$track&&i.$track.track){var s=Array.from(i.$track.track.cues),u=e(n,-5,5);s.forEach((function(t,n){c[n]||(c[n]={startTime:t.startTime,endTime:t.endTime}),t.startTime=e(c[n].startTime+u,0,a.duration),t.endTime=e(c[n].endTime+u,0,a.duration)})),r.show="".concat(o.get("Subtitle offset time"),": ").concat(n,"s"),t.emit("subtitleOffset",n)}else r.show="".concat(o.get("No subtitles found")),t.emit("subtitleOffset",0)}}}function pe(t){var e=t.events.proxy,n=t.template,r=t.player,i=t.option,o=t.setting,a=t.i18n;function c(e){if(e){var o=n.$video.canPlayType(e.type);if("maybe"===o||"probably"===o){var a=URL.createObjectURL(e);i.title=e.name,r.switchUrl(a,e.name),t.emit("localVideo",e)}else E(!1,"Playback of this file format is not supported")}}function s(t){var n=m(t,'');g(t,"position","relative"),b(n,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(n,"change",(function(){c(n.files[0])}))}return e(n.$player,"dragover",(function(t){t.preventDefault()})),e(n.$player,"drop",(function(t){t.preventDefault(),c(t.dataTransfer.files[0])})),t.on("ready",(function(){o.add({title:"Local Video",name:"localVideo",index:30,html:'
'.concat(a.get("Local Video"),'
').concat(a.get("Open"),'
'),mounted:function(e){var n=p(".art-upload-btn",e),r=p(".art-upload-value",e);t.on("localVideo",(function(t){r.textContent=t.name,r.title=t.name})),s(n)}})})),{name:"localVideo",attach:s}}function de(t){var e=t.events.proxy,n=t.subtitle,r=t.setting,i=t.i18n;function o(r){var i=m(r,'');g(r,"position","relative"),b(i,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(i,"change",(function(){!function(e){if(e){var r=D(e.name);if(["ass","vtt","srt"].includes(r)){var i=URL.createObjectURL(e);n.switch(i,e.name,r),t.emit("localSubtitle",e)}else E(!1,"Only supports subtitle files in .ass, .vtt and .srt format")}}(i.files[0])}))}return t.on("ready",(function(){r.add({title:"Local Subtitle",name:"localSubtitle",index:40,html:'
'.concat(i.get("Local Subtitle"),'
').concat(i.get("Open"),'
'),mounted:function(e){var n=p(".art-upload-btn",e),r=p(".art-upload-value",e);t.on("localSubtitle",(function(t){r.textContent=t.name,r.title=t.name})),o(n)}})})),{name:"localSubtitle",attach:o}}function he(t){var e=t.layers,n=t.player,r=t.option.theme;return e.add({name:"miniProgressBar",style:{display:"none",position:"absolute",left:0,right:0,bottom:0,height:"2px",background:r},mounted:function(e){t.on("control:toggle",(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*n.played,"%")}))}}),{name:"miniProgressBar"}}function ye(t){var e=1e4,n=0,r=0,i=0,o=null;function a(){n=0,r=0,i=0,cancelAnimationFrame(o),o=null}function c(){o||function a(){t.isDestroy||(o=requestAnimationFrame((function(){var o=Date.now();if(i){var c=o-i;r+=c,t.player.playing||(n+=c)}i=o,t.emit("networkMonitor",n/r),r>=e&&(n=0,r=0),a()})))}()}return t.on("play",c),t.on("pause",a),{name:"networkMonitor",reset:a,start:c,sample:function(t){e=t}}}var ve=function(){function e(n){var r=this;t(this,e),this.art=n,this.id=0;var i=n.option;i.subtitle.url&&i.subtitleOffset&&this.add(fe),!i.isLive&&i.miniProgressBar&&this.add(he),i.localVideo&&this.add(pe),i.localSubtitle&&this.add(de),i.networkMonitor&&this.add(ye),n.option.plugins.forEach((function(t){r.add(t)}))}return n(e,[{key:"add",value:function(t){this.id+=1;var e=t.call(this,this.art),n="";return E(!V(this,n=e&&e.name?e.name:t.name?t.name:"plugin".concat(this.id)),"Cannot add a plugin that already has the same name: ".concat(n)),Object.defineProperty(this,n,{value:e}),this.art.emit("plugin:add",t),this}}]),e}(),me=function e(n){t(this,e);var r=n.option,i=n.events.proxy,o=n.template.$video;J.events.forEach((function(t){i(o,t,(function(t){n.emit("video:".concat(t.type),t)}))})),Object.keys(r.moreVideoAttr).forEach((function(t){o[t]=r.moreVideoAttr[t]})),r.muted&&(o.muted=r.muted),r.volume&&(o.volume=U(r.volume,0,1)),r.poster&&(o.poster=r.poster),r.autoplay&&(o.autoplay=r.autoplay),o.controls=!0;var a=r.type||D(r.url),c=r.customType[a];a&&c?(c(o,r.url,n),n.emit("customType",a)):(o.src=r.url,n.emit("urlChange",o.src))},ge=0,be=function(e){function r(e){var n;return t(this,r),(n=a(this,c(r).call(this))).option=l(H(r.option,e),Y),n.isFocus=!1,n.isDestroy=!1,n.whitelist=new G(o(n)),n.template=new Q(o(n)),n.events=new Zt(o(n)),n.whitelist.state?(n.storage=new ue(o(n)),n.icons=new ee(o(n)),n.i18n=new et(o(n)),n.notice=new Qt(o(n)),n.player=new it(o(n)),n.layers=new Jt(o(n)),n.controls=new At(o(n)),n.contextmenu=new Ut(o(n)),n.subtitle=new Xt(o(n)),n.info=new _t(o(n)),n.loading=new Gt(o(n)),n.hotkey=new Yt(o(n)),n.mask=new Kt(o(n)),n.setting=new se(o(n)),n.plugins=new ve(o(n))):n.mobile=new me(o(n)),ge+=1,n.id=ge,r.instances.push(o(n)),n}return u(r,e),n(r,[{key:"destroy",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.events.destroy(),this.template.destroy(t),r.instances.splice(r.instances.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}],[{key:"version",get:function(){return"3.2.5"}},{key:"env",get:function(){return'"production"'}},{key:"config",get:function(){return J}},{key:"utils",get:function(){return X}},{key:"scheme",get:function(){return Y}},{key:"Emitter",get:function(){return f}},{key:"validator",get:function(){return l}},{key:"kindOf",get:function(){return l.kindOf}},{key:"option",get:function(){return{container:"#artplayer",url:"",poster:"",title:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,loop:!1,flip:!1,playbackRate:!1,aspectRatio:!1,screenshot:!1,setting:!1,hotkey:!0,pip:!1,mutex:!0,fullscreen:!1,fullscreenWeb:!1,subtitleOffset:!1,miniProgressBar:!1,localVideo:!1,localSubtitle:!1,autoPip:!1,networkMonitor:!1,layers:[],contextmenu:[],quality:[],controls:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,width:160,height:90,column:10},subtitle:{url:"",style:{}},moreVideoAttr:{controls:!1,preload:"metadata"},icons:{},customType:{},lang:navigator.language.toLowerCase()}}}]),r}(f);return Object.defineProperty(be,"instances",{value:[]}),console.log("%c ArtPlayer %c 3.2.5 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),be})); diff --git a/packages/artplayer/src/contextmenu/aspectRatio.js b/packages/artplayer/src/contextmenu/aspectRatio.js index dc5565008..4bd030744 100644 --- a/packages/artplayer/src/contextmenu/aspectRatio.js +++ b/packages/artplayer/src/contextmenu/aspectRatio.js @@ -5,8 +5,7 @@ export default function aspectRatio(option) { const { i18n, player } = art; return { ...option, - html: ` - ${i18n.get('Aspect ratio')}: + html: `${i18n.get('Aspect ratio')}: ${i18n.get('Default')} 4:3 16:9 diff --git a/packages/artplayer/src/contextmenu/playbackRate.js b/packages/artplayer/src/contextmenu/playbackRate.js index 26cf7ea42..a185852b2 100644 --- a/packages/artplayer/src/contextmenu/playbackRate.js +++ b/packages/artplayer/src/contextmenu/playbackRate.js @@ -5,8 +5,7 @@ export default function playbackRate(option) { const { i18n, player } = art; return { ...option, - html: ` - ${i18n.get('Play speed')}: + html: `${i18n.get('Play speed')}: 0.5 0.75 ${i18n.get('Normal')} diff --git a/packages/artplayer/src/i18n/zh-cn.json b/packages/artplayer/src/i18n/zh-cn.json index 8e959ef66..6812d6361 100644 --- a/packages/artplayer/src/i18n/zh-cn.json +++ b/packages/artplayer/src/i18n/zh-cn.json @@ -1,5 +1,4 @@ { - "About author": "关于作者", "Video info": "视频统计信息", "Close": "关闭", "Video load failed": "视频加载失败", diff --git a/packages/artplayer/src/i18n/zh-tw.json b/packages/artplayer/src/i18n/zh-tw.json index bf9e34b52..0b94c9e4e 100644 --- a/packages/artplayer/src/i18n/zh-tw.json +++ b/packages/artplayer/src/i18n/zh-tw.json @@ -1,5 +1,4 @@ { - "About author": "關於作者", "Video info": "影片統計訊息", "Close": "關閉", "Video load failed": "影片載入失敗",