From 1c58255301ee6c91a0f0ff554587d25d31629282 Mon Sep 17 00:00:00 2001 From: Harvey Date: Fri, 15 Nov 2019 11:28:49 +0800 Subject: [PATCH] remove comments --- dist/artplayer.js | 8 +------- packages/artplayer/dist/artplayer.js | 8 +------- scripts/creatRollupConfig.js | 3 +++ 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/dist/artplayer.js b/dist/artplayer.js index 18d0d2d50..0c94e8dec 100644 --- a/dist/artplayer.js +++ b/dist/artplayer.js @@ -5,10 +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 P(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]")},x=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})),E=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 x(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 S(t,e){if(!t)throw new E(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 T(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 C(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 A=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 V(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 U=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:P,ArtPlayerError:E,errorHandle:S,srtToVtt:$,vttToBlob:R,assToVtt:T,getExt:D,downloadFile:C,hasOwnProperty:q,proxyPropertys:W,mergeDeep:F,sleep:H,debounce:V,throttle:B,clamp:I,secondToTime:N});function _(t,e,n){return S("string"===e||t instanceof Element,"".concat(n.join(".")," require 'string' or 'Element' type"))}var X={container:_,url:"string|function",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",autoPip:"boolean",networkMonitor:"boolean",plugins:["function"],whitelist:["string|function|regexp"],layers:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:_,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined"}],contextmenu:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:_,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:_,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined",position:function(t,e,n){var r=["top","left","right"];return S(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"},Y={video:{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"]}},Z=function e(n){var r=this;t(this,e);var i=n.constructor.kindOf,o=n.option.whitelist;this.userAgent=window.navigator.userAgent,this.isMobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(this.userAgent),this.state=!this.isMobile||o.some((function(t){switch(i(t)){case"string":return r.userAgent.indexOf(t)>-1;case"function":return t(r.userAgent);case"regexp":return t.test(r.userAgent);default:return!1}}))},J=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),S(this.$container,"No container element found by ".concat(n.option.container))),S(n.constructor.instances.every((function(t){return t.template.$container!==r.$container})),"Cannot mount multiple instances on the same dom element"),S(this.$container.clientWidth&&this.$container.clientHeight,"The width and height of the container cannot be 0"),n.whitelist.state?this.initDesktop():this.initMobile()}return n(e,[{key:"query",value:function(t){return p(t,this.$container)}},{key:"initDesktop",value:function(){this.$container.innerHTML='\n
\n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
Player version:
\n
3.1.18
\n
\n
\n
Video url:
\n
\n
\n
\n
Video volume:
\n
\n
\n
\n
Video time:
\n
\n
\n
\n
Video duration:
\n
\n
\n
\n
Video resolution:
\n
\n x \n
\n
\n
\n
[x]
\n
\n
\n
\n
×
\n
\n
\n
\n '),this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video"),this.$track=this.query(".artplayer-video track"),this.$subtitle=this.query(".artplayer-subtitle"),this.$danmuku=this.query(".artplayer-danmuku"),this.$bottom=this.query(".artplayer-bottom"),this.$progress=this.query(".artplayer-progress"),this.$controls=this.query(".artplayer-controls"),this.$controlsLeft=this.query(".artplayer-controls-left"),this.$controlsRight=this.query(".artplayer-controls-right"),this.$layers=this.query(".artplayer-layers"),this.$loading=this.query(".artplayer-loading"),this.$notice=this.query(".artplayer-notice"),this.$noticeInner=this.query(".artplayer-notice-inner"),this.$mask=this.query(".artplayer-mask"),this.$state=this.query(".artplayer-state"),this.$setting=this.query(".artplayer-setting"),this.$settingInner=this.query(".artplayer-setting-inner"),this.$settingBody=this.query(".artplayer-setting-body"),this.$info=this.query(".artplayer-info"),this.$infoPanel=this.query(".artplayer-info-panel"),this.$infoClose=this.query(".artplayer-info-close"),this.$pipHeader=this.query(".artplayer-pip-header"),this.$pipTitle=this.query(".artplayer-pip-title"),this.$pipClose=this.query(".artplayer-pip-close"),this.$contextmenu=this.query(".artplayer-contextmenu")}},{key:"initMobile",value:function(){this.$container.innerHTML='\n
\n \n
\n ',this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video")}},{key:"destroy",value:function(t){t?this.$container.innerHTML="":h(this.$player,"artplayer-destroy")}}]),e}(),G={"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:"正常","Switch video":"切换","Switch subtitle":"切换字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"网页全屏","Exit web fullscreen":"退出网页全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},Q={"About author":"關於作者","Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"影片翻轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide subtitle":"隱藏字幕","Show subtitle":"顯示字幕","Show setting":"顯示设置","Hide setting":"隱藏设置","Hide danmu":"隱藏彈幕","Show danmu":"顯示彈幕",Screenshot:"截圖","Play speed":"播放速度","Aspect ratio":"畫面比例",Default:"默認",Normal:"正常","Switch video":"切換","Switch subtitle":"切換字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"網頁全屏","Exit web fullscreen":"退出網頁全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},K=function(){function e(n){t(this,e),this.art=n,this.languages={"zh-cn":G,"zh-tw":Q},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=F(this.languages,t),this.init()}}]),e}();var tt=r((function(t){ -/*! - * screenfull - * v5.0.0 - 2019-09-09 - * (c) Sindre Sorhus; MIT License - */ -!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={};r1&&void 0!==arguments[1]?arguments[1]:"unknown";if(a!==o.$video.src){URL.revokeObjectURL(o.$video.src);var s=e.currentTime,u=e.playing;return e.attachUrl(a).then((function(){i.url=a,e.playbackRate=!1,e.aspectRatio=!1,t.on("ready",(function(){e.currentTime=s})),u&&(e.play=!0),r.show("".concat(n.get("Switch video"),": ").concat(c)),t.emit("switch",a)}))}return null}}),Object.defineProperty(e,"switchUrl",{value:function(a){var c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unknown";if(a!==o.$video.src){URL.revokeObjectURL(o.$video.src);var s=e.playing;return e.attachUrl(a).then((function(){i.url=a,e.playbackRate=!1,e.aspectRatio=!1,t.on("ready",(function(){e.currentTime=0})),s&&(e.play=!0),r.show("".concat(n.get("Switch video"),": ").concat(c)),t.emit("switch",a)}))}return null}})}(n,this),function(t,e){var n=t.template,r=n.$video,i=n.$player,o=t.i18n,a=t.notice;Object.defineProperty(e,"playbackRate",{get:function(){return i.dataset.playbackRate},set:function(n){if(n){var c=[.5,.75,1,1.25,1.5,1.75,2];if(S(c.includes(n),"'playbackRate' only accept ".concat(c.toString()," as parameters")),n===i.dataset.playbackRate)return;r.playbackRate=n,i.dataset.playbackRate=n,a.show("".concat(o.get("Rate"),": ").concat(1===n?o.get("Normal"):"".concat(n,"x"))),t.emit("playbackRateChange",n)}else e.playbackRate&&(e.playbackRate=1,delete i.dataset.playbackRate,t.emit("playbackRateRemove"))}}),Object.defineProperty(e,"playbackRateReset",{set:function(n){if(n){var r=i.dataset.playbackRate;r&&(e.playbackRate=Number(r),t.emit("playbackRateReset"))}}})}(n,this),function(t,e){var n=t.template,r=n.$video,i=n.$player,o=t.i18n,a=t.notice;Object.defineProperty(e,"aspectRatio",{get:function(){return i.dataset.aspectRatio||""},set:function(n){if(n){var c=["default","4:3","16:9"];if(S(c.includes(n),"'aspectRatio' only accept ".concat(c.toString()," as parameters")),"default"===n)e.aspectRatio=!1;else{var s=n.split(":"),u=r.videoWidth,l=r.videoHeight,f=i.clientWidth,p=i.clientHeight,d=u/l,h=s[0]/s[1];if(d>h){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"))}}),Object.defineProperty(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;Object.defineProperty(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}}}),Object.defineProperty(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)}}))}}),Object.defineProperty(e,"screenshot",{value:function(){var r=e.getScreenshotDataURL();r&&(C(r,"".concat(n.title||"artplayer","_").concat(N(i.currentTime),".png")),t.emit("screenshot",r))}})}(n,this),function(t,e){var n=t.i18n,r=t.notice,i=t.events.destroyEvents,o=t.template.$player,a=function(){t.emit("fullscreen:change",tt.isFullscreen)},c=function(){r.show(n.get("Does not support fullscreen"))};e.fullscreenIsEnabled&&(tt.on("change",a),tt.on("error",c),i.push((function(){tt.off("change",a),tt.off("error",c)}))),Object.defineProperty(e,"fullscreen",{get:function(){return tt.isFullscreen},set:function(n){e.fullscreenIsEnabled?n?(e.fullscreenWeb&&(e.fullscreenWeb=!1),tt.request(o).then((function(){h(o,"artplayer-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreen:enabled")}))):(e.fullscreenWeb&&(e.fullscreenWeb=!1),tt.exit().then((function(){y(o,"artplayer-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreen:exit")}))):c()}}),Object.defineProperty(e,"fullscreenToggle",{set:function(t){t&&(e.fullscreen=!e.fullscreen)}}),Object.defineProperty(e,"fullscreenIsEnabled",{get:function(){return tt.isEnabled}})}(n,this),function(t,e){var n=t.template.$player;Object.defineProperty(e,"fullscreenWeb",{get:function(){return v(n,"artplayer-web-fullscreen")},set:function(r){r?(e.fullscreen&&(e.fullscreen=!1),h(n,"artplayer-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWeb:enabled")):(e.fullscreen&&(e.fullscreen=!1),y(n,"artplayer-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWeb:exit"))}}),Object.defineProperty(e,"fullscreenWebToggle",{set:function(t){t&&(e.fullscreenWeb=!e.fullscreenWeb)}})}(n,this),et(n,this),function(t,e){var n=t.template.$video;Object.defineProperty(e,"loaded",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1)/n.duration:0}}),Object.defineProperty(e,"loadedTime",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1):0}})}(n,this),function(t,e){Object.defineProperty(e,"played",{get:function(){return t.template.$video.currentTime/t.template.$video.duration}})}(n,this),function(t,e){var n=t.template.$video;Object.defineProperty(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;Object.defineProperty(e,"autoSize",{get:function(){return v(r,"artplayer-auto-size")},set:function(e){if(e){var n=o.videoWidth,a=o.videoHeight,c=r.getBoundingClientRect(),s=c.width,u=c.height,l=n/a,f=s/u;if(h(r,"artplayer-auto-size"),f>l){g(i,"width","".concat(u*l/s*100,"%")),g(i,"height","100%")}else{var p=s/l/u*100;g(i,"width","100%"),g(i,"height","".concat(p,"%"))}t.emit("autoSizeChange")}else y(r,"artplayer-auto-size"),g(i,"width",null),g(i,"height",null),t.emit("autoSizeRemove")}})}(n,this),function(t,e){Object.defineProperty(e,"rect",{get:function(){return t.template.$player.getBoundingClientRect()}}),["bottom","height","left","right","top","width"].forEach((function(t){Object.defineProperty(e,t,{get:function(){return e.rect[t]}})})),Object.defineProperty(e,"x",{get:function(){return e.left+window.pageXOffset}}),Object.defineProperty(e,"y",{get:function(){return e.top+window.pageYOffset}})}(n,this),function(t,e){Object.defineProperty(e,"flip",{get:function(){return t.template.$player.dataset.flip},set:function(e){if(e){var n=["normal","horizontal","vertical"];S(n.includes(e),"'flip' only accept ".concat(n.toString()," as parameters")),t.template.$player.dataset.flip=e,t.emit("flipChange",e)}else delete t.template.$player.dataset.flip,t.emit("flipRemove")}})}(n,this),W(n,this)};function rt(t,e,n,r,i,o){var a="function"==typeof r?r(t):r;if(a.disable)return{};var c=e.id,s=a.name||"".concat(o).concat(c);S(!q(e,s),"Cannot create a component that already has the same name: ".concat(o," -> ").concat(s));var u=document.createElement("div");u.classList.value="art-".concat(o," art-").concat(o,"-").concat(s),a.html&&m(u,a.html),a.style&&b(u,a.style),a.tooltip&&P(u,a.tooltip);var l=Array.from(n.children);u.dataset.index=a.index||c;var f=l.find((function(t){return Number(t.dataset.index)>=Number(u.dataset.index)}));return f?f.insertAdjacentElement("beforebegin",u):m(n,u),a.click&&t.events.proxy(u,"click",(function(n){n.preventDefault(),a.click.call(t,e,n),t.emit("".concat(o,":click"),u)})),a.mounted&&a.mounted(u,e,t),i&&i(u,e,t),Object.defineProperty(e,s,{value:{get id(){return c},get $ref(){return u},set show(e){e?(g(u,"display","block"),t.emit("".concat(o,":show"),u)):(g(u,"display","none"),t.emit("".concat(o,":hide"),u))}}}),t.emit("".concat(o,":add"),a),e[s]}var it=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 ot(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 at(t){return function(e){return function(t){for(var e=1;e\n
\n
\n
\n
\n
\n \n '),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=I(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=ht(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=ht(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=ht(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=ht(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 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 mt(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 I(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"))}}P(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(l,"mousemove",(function(t){a&&(i.muted=!1,i.volume=f(t))})),n(document,"mouseup",(function(){a&&(a=!1)}))}})}}function jt(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 Pt(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 Et(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 St(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.innerHTML=o,c=e)}))}})}}var Tt=function(){function e(n){var r=this;t(this,e),this.id=0,this.art=n,this.art.on("ready",(function(){r.init()}))}return n(e,[{key:"init",value:function(){var t=this,e=this.art.option;this.add(yt({name:"progress",disable:e.isLive,position:"top",index:10})),this.add(xt({name:"thumbnails",disable:!e.thumbnails.url||e.isLive,position:"top",index:20})),this.add(pt({name:"playAndPause",disable:!1,position:"left",index:10})),this.add(Ot({name:"volume",disable:!1,position:"left",index:20})),this.add(bt({name:"time",disable:e.isLive,position:"left",index:30})),this.add(Rt({name:"quality",disable:0===e.quality.length,position:"right",index:10})),this.add(St({name:"screenshot",disable:!e.screenshot,position:"right",index:20})),this.add(mt({name:"subtitle",disable:!e.subtitle.url,position:"right",index:30})),this.add(Pt({name:"setting",disable:!e.setting,position:"right",index:40})),this.add(lt({name:"pip",disable:!e.pip,position:"right",index:50})),this.add(st({name:"fullscreenWeb",disable:!e.fullscreenWeb,position:"right",index:60})),this.add(at({name:"fullscreen",disable:!e.fullscreen,position:"right",index:70})),e.controls.forEach((function(e){t.add(e)}))}},{key:"add",value:function(t,e){var n,r="function"==typeof t?t(this.art):t,i=this.art.template,o=i.$progress,a=i.$controlsLeft,c=i.$controlsRight;switch(r.position){case"top":n=o;break;case"left":n=a;break;case"right":n=c}this.id+=1,S(r.position,"Controls option.position can not be empty");var s=rt(this.art,this,n,r,e,"control");return r.disable||"top"===r.position||s.$ref.firstElementChild&&"I"===s.$ref.firstElementChild.tagName||h(s.$ref,"art-control-onlyText"),s}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-controls-show"),this.art.emit("controls:show")):(this.state=!1,y(e,"artplayer-controls-show"),this.art.emit("controls:hide"))}}]),e}();function Dt(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 Ct(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e0.5\n 0.75\n ').concat(n.get("Normal"),'\n 1.25\n 1.5\n 2.0\n '),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,"current")}))}})}}function At(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){var n=e.i18n,r=e.player;return function(t){for(var e=1;e').concat(n.get("Default"),'\n 4:3\n 16:9\n '),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,"current")}))}})}}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 zt(t){return function(e){return function(t){for(var e=1;eArtPlayer 3.1.18'})}function Ft(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 Ht(t){return function(e){return function(t){for(var e=1;eu+s&&(h=s-d),o+p>l+c&&(y=c-p),g(r,"left","".concat(h,"px")),g(r,"top","".concat(y,"px"))}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-contextmenu-show"),this.art.emit("contextmenu:show")):(this.state=!1,y(e,"artplayer-contextmenu-show"),this.art.emit("contextmenu:hide"))}}]),e}(),Bt=function(){function e(n){var r=this;t(this,e),this.art=n,this.timer=null;var i=n.template,o=i.$infoPanel,a=i.$infoClose,c=n.events.proxy;this.types=d("[data-video]",o),c(a,"click",(function(){r.show=!1})),this.art.on("destroy",(function(){clearTimeout(r.timer)}))}return n(e,[{key:"readInfo",value:function(){var t=this.art.template.$video;this.types.forEach((function(e){var n=t[e.dataset.video];e.innerHTML="number"==typeof n?n.toFixed(2):n}))}},{key:"loop",value:function(){var t=this;this.readInfo(),this.timer=setTimeout((function(){t.readInfo(),t.loop()}),1e3)}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-info-show"),clearTimeout(this.timer),this.loop(),this.art.emit("info:show")):(this.state=!1,y(e,"artplayer-info-show"),clearTimeout(this.timer),this.art.emit("info:hide"))}}]),e}(),It=function(){function e(n){t(this,e),this.art=n,this.state=!0;var r=n.events.proxy,i=n.option.subtitle;b(n.template.$subtitle,i.style),r(this.textTrack,"cuechange",this.update.bind(this)),i.url&&this.init(i.url)}return n(e,[{key:"update",value:function(){var t=this.art.template.$subtitle;t.innerHTML="",this.activeCue&&(t.innerHTML=this.activeCue.text.split(/\r?\n/).map((function(t){return"

".concat(t,"

")})).join("")),this.art.emit("subtitle:update",t)}},{key:"switch",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unknown",r=this.art,i=r.i18n,o=r.notice;return this.init(t).then((function(t){return o.show("".concat(i.get("Switch subtitle"),": ").concat(n)),e.art.emit("subtitle:switch",t),t}))}},{key:"init",value:function(t){var e=this,n=this.art,r=n.notice,i=n.template,o=i.$subtitle,a=i.$track;return fetch(t).then((function(t){return t.text()})).then((function(e){switch(D(t)){case"srt":return R($(e));case"ass":return R(T(e));case"vtt":return R(e);default:return t}})).then((function(t){return o.innerHTML="",e.url===t?t:(URL.revokeObjectURL(e.url),a.src=t,t)})).catch((function(t){throw r.show(t),t}))}},{key:"toggle",value:function(){this.show=!this.state}},{key:"url",get:function(){return this.art.template.$track.src}},{key:"textTrack",get:function(){return this.art.template.$video.textTracks[0]}},{key:"activeCue",get:function(){return this.textTrack.activeCues[0]}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,y(e,"artplayer-subtitle-hide"),this.art.emit("subtitle:show")):(this.state=!1,h(e,"artplayer-subtitle-hide"),this.art.emit("subtitle:hide"))}}]),e}();var Nt=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.once("video:canplay",(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,"artplayer-hover"),t.emit("hoverenter")}),(function(){y(n,"artplayer-hover"),t.emit("hoverleave")}))}(n,r),function(t,e){var n=t.template,r=n.$player,i=n.$video,o=t.player,a=V((function(){h(r,"artplayer-hide-cursor"),y(r,"artplayer-hover"),t.controls.show=!1}),3e3);t.on("hoverleave",(function(){o.playing&&a()})),e.proxy(r,"mousemove",(function(e){a.clearTimeout(),y(r,"artplayer-hide-cursor"),t.controls.show=!0,!t.player.pip&&o.playing&&e.target===i&&a()}))}(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=B((function(){r.width===a&&r.height===c||(a=r.width,c=r.height,n.autoSize&&(t.player.fullscreen||t.player.fullscreenWeb||t.player.pip?t.player.autoSize=!1:t.player.autoSize=!0),t.player.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]:{};Array.isArray(e)?e.forEach((function(e){return r.proxy(t,e,n,i)})):(t.addEventListener(e,n,i),this.destroyEvents.push((function(){t.removeEventListener(e,n,i)})))}},{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}(),Ut=function(){function e(n){var r=this;t(this,e),this.art=n,this.keys={},this.art.option.hotkey&&this.art.on("ready",(function(){r.add(27,(function(){n.player.fullscreenWeb&&(n.player.fullscreenWeb=!1)})),r.add(32,(function(){n.player.toggle=!0})),r.add(37,(function(){n.player.seek=n.player.currentTime-5})),r.add(38,(function(){n.player.volume+=.1})),r.add(39,(function(){n.player.seek=n.player.currentTime+5})),r.add(40,(function(){n.player.volume-=.1})),r.init()}))}return n(e,[{key:"add",value:function(t,e){this.keys[t]?this.keys[t].push(e):this.keys[t]=[e]}},{key:"init",value:function(){var t=this;(0,this.art.events.proxy)(window,"keydown",(function(e){if(t.art.isFocus){var n=document.activeElement.tagName.toUpperCase(),r=document.activeElement.getAttribute("contenteditable");if("INPUT"!==n&&"TEXTAREA"!==n&&""!==r&&"true"!==r){var i=t.keys[e.keyCode];i&&(e.preventDefault(),i.forEach((function(t){return t()})),t.art.emit("hotkey",e))}}}))}}]),e}(),_t=function(){function e(n){var r=this;t(this,e),this.id=0,this.art=n,this.add=this.add.bind(this),this.art.on("ready",(function(){r.art.option.layers.forEach((function(t){r.add(t)}))}))}return n(e,[{key:"add",value:function(t,e){this.id+=1;var n=this.art.template.$layers;return rt(this.art,this,n,t,e,"layer")}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,y(e,"artplayer-layers-hide"),this.art.emit("layers:show")):(this.state=!1,h(e,"artplayer-layers-hide"),this.art.emit("layers:hide"))}}]),e}(),Xt=function(){function e(n){t(this,e),this.art=n,m(n.template.$loading,n.icons.loading)}return n(e,[{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-loading-show"),this.art.emit("loading:show")):(this.state=!1,y(e,"artplayer-loading-show"),this.art.emit("loading:hide"))}}]),e}(),Yt=function(){function e(n){t(this,e),this.art=n,this.timer=null}return n(e,[{key:"show",value:function(t){var e=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=this.art.template,o=i.$player,a=i.$noticeInner;this.state=!0,h(o,"artplayer-notice-show"),a.innerHTML=t instanceof Error?t.message.trim():t,clearTimeout(this.timer),n&&(this.timer=setTimeout((function(){e.hide()}),r)),this.art.emit("notice:show")}},{key:"hide",value:function(){var t=this.art.template.$player;this.state=!1,y(t,"artplayer-notice-show"),this.art.emit("notice:hide")}}]),e}(),Zt=function(){function e(n){t(this,e),this.art=n,m(n.template.$state,n.icons.state)}return n(e,[{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-mask-show"),this.art.emit("mask:show")):(this.state=!1,y(e,"artplayer-mask-show"),this.art.emit("mask:hide"))}}]),e}(),Jt=function e(n){var r=this;t(this,e);var i=Object.assign({loading:'\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n',state:'\n \n',play:'\n \n',pause:'\n \n',volume:'\n \n \n',volumeClose:'\n \n \n',subtitle:'\n \n \n',screenshot:'\n\t\n\n',setting:'\n \n \n',fullscreen:'\n\t\n\t\n\t\n\t\n',fullscreenWeb:'\n\t\n',pip:'\n \n',prev:'\n \n',next:'\n \n'},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 Gt(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;e'.concat(n.get("Flip"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n "),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 Kt(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 te(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e'.concat(n.get("Aspect ratio"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n '),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 ee(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 ne(t){return function(e){var n=e.i18n,r=e.player,i=e.events.proxy;return function(t){for(var e=1;e\n '.concat(n.get("Play speed"),': 1.0x\n \n
\n \n
\n '),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 re=function(){function e(n){var r=this;t(this,e),this.id=0,this.art=n,this.state=!1,n.option.setting&&(this.art.on("ready",(function(){r.init()})),this.art.on("blur",(function(){r.show=!1})))}return n(e,[{key:"init",value:function(){var t=this,e=this.art,n=e.option,r=e.template.$setting;(0,e.events.proxy)(r,"click",(function(e){e.target===r&&(t.show=!1)})),this.add(Qt({disable:!n.flip,name:"flip"})),this.add(te({disable:!n.aspectRatio,name:"aspectRatio"})),this.add(ne({disable:!n.playbackRate,name:"playbackRate"}))}},{key:"add",value:function(t,e){this.id+=1;var n=this.art.template.$settingBody;return rt(this.art,this,n,t,e,"setting")}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-setting-show"),this.art.emit("setting:show")):(this.state=!1,y(e,"artplayer-setting-show"),this.art.emit("setting:hide"))}}]),e}(),ie=function(){function e(n){t(this,e),this.art=n,this.name="artplayer_settings";var r=n.option,i=this.get("volume");i&&(r.volume=i)}return n(e,[{key:"get",value:function(t){var e=JSON.parse(window.localStorage.getItem(this.name))||{};return t?e[t]:{}}},{key:"set",value:function(t,e){var n=Object.assign({},this.get(),it({},t,e));window.localStorage.setItem(this.name,JSON.stringify(n))}},{key:"del",value:function(t){var e=this.get();delete e[t],window.localStorage.setItem(this.name,JSON.stringify(e))}},{key:"clean",value:function(){window.localStorage.removeItem(this.name)}}]),e}();function oe(t){var e=t.i18n,n=t.subtitle,r=t.events.proxy;return{title:"Subtitle",name:"subtitle",index:20,html:'\n
\n '.concat(e.get("Subtitle offset time"),': 0s\n
\n
\n \n
\n '),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("artplayerPluginSubtitleOffset",(function(t){n.update(),i.value!==t&&(i.value=t,o.innerText=t)}))}}}function ae(t){var e=t.constructor.utils.clamp,n=t.setting,r=t.notice,i=t.template,o=t.i18n,a=t.player;o.update({"zh-cn":{"Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},"zh-tw":{"Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"}}),n.add(oe);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("artplayerPluginSubtitleOffset",n)}else r.show("".concat(o.get("No subtitles found"))),t.emit("artplayerPluginSubtitleOffset",0)}}}function ce(t){var e=t.events.proxy,n=t.template,r=t.player;function i(t){if(t){var e=n.$video.canPlayType(t.type);if("maybe"===e||"probably"===e){var i=URL.createObjectURL(t);r.switchUrl(i,t.name)}else S(!1,"Playback of this file format is not supported")}}return e(n.$player,"dragover",(function(t){t.preventDefault()})),e(n.$player,"drop",(function(t){t.preventDefault(),i(t.dataTransfer.files[0])})),{name:"localVideo",attach:function(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(){i(n.files[0])}))}}}function se(t){var e=t.events.proxy,n=t.subtitle;return{name:"localSubtitle",attach:function(t){var r=m(t,'');g(t,"position","relative"),b(r,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(r,"change",(function(){!function(t){if(t){var r=D(t.name);if(["ass","vtt","srt"].includes(r)){var i=new FileReader;e(i,"load",(function(e){var i=e.target.result;switch(r){case"srt":var o=R($(i));n.switch(o,t.name);break;case"ass":var a=R(T(i));n.switch(a,t.name);break;case"vtt":var c=R(i);n.switch(c,t.name)}})),i.readAsText(t)}else S(!1,"Only supports subtitle files in .ass, .vtt and .srt format")}}(r.files[0])}))}}}function ue(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("controls:show",(function(){e.style.display="none"})),t.on("destroy",(function(){e.style.display="none"})),t.on("controls:hide",(function(){e.style.display="block"})),t.on("video:timeupdate",(function(){e.style.width="".concat(100*n.played,"%")}))}}),{name:"miniProgressBar"}}function le(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}}}function fe(t){var e=t.events,n=t.player,r=t.template,i=V((function(){var e=r.$player.getBoundingClientRect();e.top+e.height<=0&&!n.pip?(n.pip=!0,t.emit("artplayerPluginAutoPip",!0)):n.pip&&(n.pip=!1,t.emit("artplayerPluginAutoPip",!1))}),300);return e.proxy(window,"scroll",i),{name:"autoPip"}}var pe=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(ae),!i.isLive&&i.miniProgressBar&&this.add(ue),i.localVideo&&this.add(ce),i.localSubtitle&&this.add(se),i.networkMonitor&&this.add(le),i.autoPip&&this.add(fe),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 S(!q(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}(),de=function e(n){t(this,e);var r=n.option,i=n.events.proxy,o=n.template.$video;Y.video.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=I(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?(n.emit("beforeCustomType",a),c(o,r.url,n),n.emit("afterCustomType",a)):(n.emit("beforeAttachUrl",r.url),o.src=r.url,n.emit("afterAttachUrl",o.src))},he=0,ye=function(e){function r(e){var n;return t(this,r),(n=a(this,c(r).call(this))).option=l(F(r.option,e),X),n.isFocus=!1,n.isDestroy=!1,n.whitelist=new Z(o(n)),n.template=new J(o(n)),n.events=new Nt(o(n)),n.whitelist.state?(n.storage=new ie(o(n)),n.icons=new Jt(o(n)),n.i18n=new K(o(n)),n.notice=new Yt(o(n)),n.player=new nt(o(n)),n.layers=new _t(o(n)),n.controls=new Tt(o(n)),n.contextmenu=new Vt(o(n)),n.subtitle=new It(o(n)),n.info=new Bt(o(n)),n.loading=new Xt(o(n)),n.hotkey=new Ut(o(n)),n.mask=new Zt(o(n)),n.setting=new re(o(n)),n.plugins=new pe(o(n))):n.mobile=new de(o(n)),he+=1,n.id=he,r.instances.push(o(n)),console.log("%c ArtPlayer %c 3.1.18 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),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.1.18"}},{key:"env",get:function(){return'"production"'}},{key:"config",get:function(){return Y}},{key:"utils",get:function(){return U}},{key:"scheme",get:function(){return X}},{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(ye,"instances",{value:[]}),ye})); +!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 P(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]")},x=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})),E=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 x(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 S(t,e){if(!t)throw new E(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 T(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 C(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 A=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 V(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 U=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:P,ArtPlayerError:E,errorHandle:S,srtToVtt:$,vttToBlob:R,assToVtt:T,getExt:D,downloadFile:C,hasOwnProperty:q,proxyPropertys:W,mergeDeep:F,sleep:H,debounce:V,throttle:B,clamp:I,secondToTime:N});function _(t,e,n){return S("string"===e||t instanceof Element,"".concat(n.join(".")," require 'string' or 'Element' type"))}var X={container:_,url:"string|function",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",autoPip:"boolean",networkMonitor:"boolean",plugins:["function"],whitelist:["string|function|regexp"],layers:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:_,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined"}],contextmenu:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:_,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:_,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined",position:function(t,e,n){var r=["top","left","right"];return S(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"},Y={video:{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"]}},Z=function e(n){var r=this;t(this,e);var i=n.constructor.kindOf,o=n.option.whitelist;this.userAgent=window.navigator.userAgent,this.isMobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(this.userAgent),this.state=!this.isMobile||o.some((function(t){switch(i(t)){case"string":return r.userAgent.indexOf(t)>-1;case"function":return t(r.userAgent);case"regexp":return t.test(r.userAgent);default:return!1}}))},J=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),S(this.$container,"No container element found by ".concat(n.option.container))),S(n.constructor.instances.every((function(t){return t.template.$container!==r.$container})),"Cannot mount multiple instances on the same dom element"),S(this.$container.clientWidth&&this.$container.clientHeight,"The width and height of the container cannot be 0"),n.whitelist.state?this.initDesktop():this.initMobile()}return n(e,[{key:"query",value:function(t){return p(t,this.$container)}},{key:"initDesktop",value:function(){this.$container.innerHTML='\n
\n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
Player version:
\n
3.1.18
\n
\n
\n
Video url:
\n
\n
\n
\n
Video volume:
\n
\n
\n
\n
Video time:
\n
\n
\n
\n
Video duration:
\n
\n
\n
\n
Video resolution:
\n
\n x \n
\n
\n
\n
[x]
\n
\n
\n
\n
×
\n
\n
\n
\n '),this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video"),this.$track=this.query(".artplayer-video track"),this.$subtitle=this.query(".artplayer-subtitle"),this.$danmuku=this.query(".artplayer-danmuku"),this.$bottom=this.query(".artplayer-bottom"),this.$progress=this.query(".artplayer-progress"),this.$controls=this.query(".artplayer-controls"),this.$controlsLeft=this.query(".artplayer-controls-left"),this.$controlsRight=this.query(".artplayer-controls-right"),this.$layers=this.query(".artplayer-layers"),this.$loading=this.query(".artplayer-loading"),this.$notice=this.query(".artplayer-notice"),this.$noticeInner=this.query(".artplayer-notice-inner"),this.$mask=this.query(".artplayer-mask"),this.$state=this.query(".artplayer-state"),this.$setting=this.query(".artplayer-setting"),this.$settingInner=this.query(".artplayer-setting-inner"),this.$settingBody=this.query(".artplayer-setting-body"),this.$info=this.query(".artplayer-info"),this.$infoPanel=this.query(".artplayer-info-panel"),this.$infoClose=this.query(".artplayer-info-close"),this.$pipHeader=this.query(".artplayer-pip-header"),this.$pipTitle=this.query(".artplayer-pip-title"),this.$pipClose=this.query(".artplayer-pip-close"),this.$contextmenu=this.query(".artplayer-contextmenu")}},{key:"initMobile",value:function(){this.$container.innerHTML='\n
\n \n
\n ',this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video")}},{key:"destroy",value:function(t){t?this.$container.innerHTML="":h(this.$player,"artplayer-destroy")}}]),e}(),G={"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:"正常","Switch video":"切换","Switch subtitle":"切换字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"网页全屏","Exit web fullscreen":"退出网页全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},Q={"About author":"關於作者","Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"影片翻轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide subtitle":"隱藏字幕","Show subtitle":"顯示字幕","Show setting":"顯示设置","Hide setting":"隱藏设置","Hide danmu":"隱藏彈幕","Show danmu":"顯示彈幕",Screenshot:"截圖","Play speed":"播放速度","Aspect ratio":"畫面比例",Default:"默認",Normal:"正常","Switch video":"切換","Switch subtitle":"切換字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"網頁全屏","Exit web fullscreen":"退出網頁全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},K=function(){function e(n){t(this,e),this.art=n,this.languages={"zh-cn":G,"zh-tw":Q},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=F(this.languages,t),this.init()}}]),e}();var tt=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={};r1&&void 0!==arguments[1]?arguments[1]:"unknown";if(a!==o.$video.src){URL.revokeObjectURL(o.$video.src);var s=e.currentTime,u=e.playing;return e.attachUrl(a).then((function(){i.url=a,e.playbackRate=!1,e.aspectRatio=!1,t.on("ready",(function(){e.currentTime=s})),u&&(e.play=!0),r.show("".concat(n.get("Switch video"),": ").concat(c)),t.emit("switch",a)}))}return null}}),Object.defineProperty(e,"switchUrl",{value:function(a){var c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unknown";if(a!==o.$video.src){URL.revokeObjectURL(o.$video.src);var s=e.playing;return e.attachUrl(a).then((function(){i.url=a,e.playbackRate=!1,e.aspectRatio=!1,t.on("ready",(function(){e.currentTime=0})),s&&(e.play=!0),r.show("".concat(n.get("Switch video"),": ").concat(c)),t.emit("switch",a)}))}return null}})}(n,this),function(t,e){var n=t.template,r=n.$video,i=n.$player,o=t.i18n,a=t.notice;Object.defineProperty(e,"playbackRate",{get:function(){return i.dataset.playbackRate},set:function(n){if(n){var c=[.5,.75,1,1.25,1.5,1.75,2];if(S(c.includes(n),"'playbackRate' only accept ".concat(c.toString()," as parameters")),n===i.dataset.playbackRate)return;r.playbackRate=n,i.dataset.playbackRate=n,a.show("".concat(o.get("Rate"),": ").concat(1===n?o.get("Normal"):"".concat(n,"x"))),t.emit("playbackRateChange",n)}else e.playbackRate&&(e.playbackRate=1,delete i.dataset.playbackRate,t.emit("playbackRateRemove"))}}),Object.defineProperty(e,"playbackRateReset",{set:function(n){if(n){var r=i.dataset.playbackRate;r&&(e.playbackRate=Number(r),t.emit("playbackRateReset"))}}})}(n,this),function(t,e){var n=t.template,r=n.$video,i=n.$player,o=t.i18n,a=t.notice;Object.defineProperty(e,"aspectRatio",{get:function(){return i.dataset.aspectRatio||""},set:function(n){if(n){var c=["default","4:3","16:9"];if(S(c.includes(n),"'aspectRatio' only accept ".concat(c.toString()," as parameters")),"default"===n)e.aspectRatio=!1;else{var s=n.split(":"),u=r.videoWidth,l=r.videoHeight,f=i.clientWidth,p=i.clientHeight,d=u/l,h=s[0]/s[1];if(d>h){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"))}}),Object.defineProperty(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;Object.defineProperty(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}}}),Object.defineProperty(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)}}))}}),Object.defineProperty(e,"screenshot",{value:function(){var r=e.getScreenshotDataURL();r&&(C(r,"".concat(n.title||"artplayer","_").concat(N(i.currentTime),".png")),t.emit("screenshot",r))}})}(n,this),function(t,e){var n=t.i18n,r=t.notice,i=t.events.destroyEvents,o=t.template.$player,a=function(){t.emit("fullscreen:change",tt.isFullscreen)},c=function(){r.show(n.get("Does not support fullscreen"))};e.fullscreenIsEnabled&&(tt.on("change",a),tt.on("error",c),i.push((function(){tt.off("change",a),tt.off("error",c)}))),Object.defineProperty(e,"fullscreen",{get:function(){return tt.isFullscreen},set:function(n){e.fullscreenIsEnabled?n?(e.fullscreenWeb&&(e.fullscreenWeb=!1),tt.request(o).then((function(){h(o,"artplayer-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreen:enabled")}))):(e.fullscreenWeb&&(e.fullscreenWeb=!1),tt.exit().then((function(){y(o,"artplayer-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreen:exit")}))):c()}}),Object.defineProperty(e,"fullscreenToggle",{set:function(t){t&&(e.fullscreen=!e.fullscreen)}}),Object.defineProperty(e,"fullscreenIsEnabled",{get:function(){return tt.isEnabled}})}(n,this),function(t,e){var n=t.template.$player;Object.defineProperty(e,"fullscreenWeb",{get:function(){return v(n,"artplayer-web-fullscreen")},set:function(r){r?(e.fullscreen&&(e.fullscreen=!1),h(n,"artplayer-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWeb:enabled")):(e.fullscreen&&(e.fullscreen=!1),y(n,"artplayer-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWeb:exit"))}}),Object.defineProperty(e,"fullscreenWebToggle",{set:function(t){t&&(e.fullscreenWeb=!e.fullscreenWeb)}})}(n,this),et(n,this),function(t,e){var n=t.template.$video;Object.defineProperty(e,"loaded",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1)/n.duration:0}}),Object.defineProperty(e,"loadedTime",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1):0}})}(n,this),function(t,e){Object.defineProperty(e,"played",{get:function(){return t.template.$video.currentTime/t.template.$video.duration}})}(n,this),function(t,e){var n=t.template.$video;Object.defineProperty(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;Object.defineProperty(e,"autoSize",{get:function(){return v(r,"artplayer-auto-size")},set:function(e){if(e){var n=o.videoWidth,a=o.videoHeight,c=r.getBoundingClientRect(),s=c.width,u=c.height,l=n/a,f=s/u;if(h(r,"artplayer-auto-size"),f>l){g(i,"width","".concat(u*l/s*100,"%")),g(i,"height","100%")}else{var p=s/l/u*100;g(i,"width","100%"),g(i,"height","".concat(p,"%"))}t.emit("autoSizeChange")}else y(r,"artplayer-auto-size"),g(i,"width",null),g(i,"height",null),t.emit("autoSizeRemove")}})}(n,this),function(t,e){Object.defineProperty(e,"rect",{get:function(){return t.template.$player.getBoundingClientRect()}}),["bottom","height","left","right","top","width"].forEach((function(t){Object.defineProperty(e,t,{get:function(){return e.rect[t]}})})),Object.defineProperty(e,"x",{get:function(){return e.left+window.pageXOffset}}),Object.defineProperty(e,"y",{get:function(){return e.top+window.pageYOffset}})}(n,this),function(t,e){Object.defineProperty(e,"flip",{get:function(){return t.template.$player.dataset.flip},set:function(e){if(e){var n=["normal","horizontal","vertical"];S(n.includes(e),"'flip' only accept ".concat(n.toString()," as parameters")),t.template.$player.dataset.flip=e,t.emit("flipChange",e)}else delete t.template.$player.dataset.flip,t.emit("flipRemove")}})}(n,this),W(n,this)};function rt(t,e,n,r,i,o){var a="function"==typeof r?r(t):r;if(a.disable)return{};var c=e.id,s=a.name||"".concat(o).concat(c);S(!q(e,s),"Cannot create a component that already has the same name: ".concat(o," -> ").concat(s));var u=document.createElement("div");u.classList.value="art-".concat(o," art-").concat(o,"-").concat(s),a.html&&m(u,a.html),a.style&&b(u,a.style),a.tooltip&&P(u,a.tooltip);var l=Array.from(n.children);u.dataset.index=a.index||c;var f=l.find((function(t){return Number(t.dataset.index)>=Number(u.dataset.index)}));return f?f.insertAdjacentElement("beforebegin",u):m(n,u),a.click&&t.events.proxy(u,"click",(function(n){n.preventDefault(),a.click.call(t,e,n),t.emit("".concat(o,":click"),u)})),a.mounted&&a.mounted(u,e,t),i&&i(u,e,t),Object.defineProperty(e,s,{value:{get id(){return c},get $ref(){return u},set show(e){e?(g(u,"display","block"),t.emit("".concat(o,":show"),u)):(g(u,"display","none"),t.emit("".concat(o,":hide"),u))}}}),t.emit("".concat(o,":add"),a),e[s]}var it=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 ot(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 at(t){return function(e){return function(t){for(var e=1;e\n
\n
\n
\n
\n
\n \n '),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=I(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=ht(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=ht(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=ht(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=ht(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 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 mt(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 I(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"))}}P(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(l,"mousemove",(function(t){a&&(i.muted=!1,i.volume=f(t))})),n(document,"mouseup",(function(){a&&(a=!1)}))}})}}function jt(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 Pt(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 Et(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 St(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.innerHTML=o,c=e)}))}})}}var Tt=function(){function e(n){var r=this;t(this,e),this.id=0,this.art=n,this.art.on("ready",(function(){r.init()}))}return n(e,[{key:"init",value:function(){var t=this,e=this.art.option;this.add(yt({name:"progress",disable:e.isLive,position:"top",index:10})),this.add(xt({name:"thumbnails",disable:!e.thumbnails.url||e.isLive,position:"top",index:20})),this.add(pt({name:"playAndPause",disable:!1,position:"left",index:10})),this.add(Ot({name:"volume",disable:!1,position:"left",index:20})),this.add(bt({name:"time",disable:e.isLive,position:"left",index:30})),this.add(Rt({name:"quality",disable:0===e.quality.length,position:"right",index:10})),this.add(St({name:"screenshot",disable:!e.screenshot,position:"right",index:20})),this.add(mt({name:"subtitle",disable:!e.subtitle.url,position:"right",index:30})),this.add(Pt({name:"setting",disable:!e.setting,position:"right",index:40})),this.add(lt({name:"pip",disable:!e.pip,position:"right",index:50})),this.add(st({name:"fullscreenWeb",disable:!e.fullscreenWeb,position:"right",index:60})),this.add(at({name:"fullscreen",disable:!e.fullscreen,position:"right",index:70})),e.controls.forEach((function(e){t.add(e)}))}},{key:"add",value:function(t,e){var n,r="function"==typeof t?t(this.art):t,i=this.art.template,o=i.$progress,a=i.$controlsLeft,c=i.$controlsRight;switch(r.position){case"top":n=o;break;case"left":n=a;break;case"right":n=c}this.id+=1,S(r.position,"Controls option.position can not be empty");var s=rt(this.art,this,n,r,e,"control");return r.disable||"top"===r.position||s.$ref.firstElementChild&&"I"===s.$ref.firstElementChild.tagName||h(s.$ref,"art-control-onlyText"),s}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-controls-show"),this.art.emit("controls:show")):(this.state=!1,y(e,"artplayer-controls-show"),this.art.emit("controls:hide"))}}]),e}();function Dt(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 Ct(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e0.5\n 0.75\n ').concat(n.get("Normal"),'\n 1.25\n 1.5\n 2.0\n '),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,"current")}))}})}}function At(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){var n=e.i18n,r=e.player;return function(t){for(var e=1;e').concat(n.get("Default"),'\n 4:3\n 16:9\n '),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,"current")}))}})}}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 zt(t){return function(e){return function(t){for(var e=1;eArtPlayer 3.1.18'})}function Ft(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 Ht(t){return function(e){return function(t){for(var e=1;eu+s&&(h=s-d),o+p>l+c&&(y=c-p),g(r,"left","".concat(h,"px")),g(r,"top","".concat(y,"px"))}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-contextmenu-show"),this.art.emit("contextmenu:show")):(this.state=!1,y(e,"artplayer-contextmenu-show"),this.art.emit("contextmenu:hide"))}}]),e}(),Bt=function(){function e(n){var r=this;t(this,e),this.art=n,this.timer=null;var i=n.template,o=i.$infoPanel,a=i.$infoClose,c=n.events.proxy;this.types=d("[data-video]",o),c(a,"click",(function(){r.show=!1})),this.art.on("destroy",(function(){clearTimeout(r.timer)}))}return n(e,[{key:"readInfo",value:function(){var t=this.art.template.$video;this.types.forEach((function(e){var n=t[e.dataset.video];e.innerHTML="number"==typeof n?n.toFixed(2):n}))}},{key:"loop",value:function(){var t=this;this.readInfo(),this.timer=setTimeout((function(){t.readInfo(),t.loop()}),1e3)}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-info-show"),clearTimeout(this.timer),this.loop(),this.art.emit("info:show")):(this.state=!1,y(e,"artplayer-info-show"),clearTimeout(this.timer),this.art.emit("info:hide"))}}]),e}(),It=function(){function e(n){t(this,e),this.art=n,this.state=!0;var r=n.events.proxy,i=n.option.subtitle;b(n.template.$subtitle,i.style),r(this.textTrack,"cuechange",this.update.bind(this)),i.url&&this.init(i.url)}return n(e,[{key:"update",value:function(){var t=this.art.template.$subtitle;t.innerHTML="",this.activeCue&&(t.innerHTML=this.activeCue.text.split(/\r?\n/).map((function(t){return"

".concat(t,"

")})).join("")),this.art.emit("subtitle:update",t)}},{key:"switch",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unknown",r=this.art,i=r.i18n,o=r.notice;return this.init(t).then((function(t){return o.show("".concat(i.get("Switch subtitle"),": ").concat(n)),e.art.emit("subtitle:switch",t),t}))}},{key:"init",value:function(t){var e=this,n=this.art,r=n.notice,i=n.template,o=i.$subtitle,a=i.$track;return fetch(t).then((function(t){return t.text()})).then((function(e){switch(D(t)){case"srt":return R($(e));case"ass":return R(T(e));case"vtt":return R(e);default:return t}})).then((function(t){return o.innerHTML="",e.url===t?t:(URL.revokeObjectURL(e.url),a.src=t,t)})).catch((function(t){throw r.show(t),t}))}},{key:"toggle",value:function(){this.show=!this.state}},{key:"url",get:function(){return this.art.template.$track.src}},{key:"textTrack",get:function(){return this.art.template.$video.textTracks[0]}},{key:"activeCue",get:function(){return this.textTrack.activeCues[0]}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,y(e,"artplayer-subtitle-hide"),this.art.emit("subtitle:show")):(this.state=!1,h(e,"artplayer-subtitle-hide"),this.art.emit("subtitle:hide"))}}]),e}();var Nt=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.once("video:canplay",(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,"artplayer-hover"),t.emit("hoverenter")}),(function(){y(n,"artplayer-hover"),t.emit("hoverleave")}))}(n,r),function(t,e){var n=t.template,r=n.$player,i=n.$video,o=t.player,a=V((function(){h(r,"artplayer-hide-cursor"),y(r,"artplayer-hover"),t.controls.show=!1}),3e3);t.on("hoverleave",(function(){o.playing&&a()})),e.proxy(r,"mousemove",(function(e){a.clearTimeout(),y(r,"artplayer-hide-cursor"),t.controls.show=!0,!t.player.pip&&o.playing&&e.target===i&&a()}))}(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=B((function(){r.width===a&&r.height===c||(a=r.width,c=r.height,n.autoSize&&(t.player.fullscreen||t.player.fullscreenWeb||t.player.pip?t.player.autoSize=!1:t.player.autoSize=!0),t.player.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]:{};Array.isArray(e)?e.forEach((function(e){return r.proxy(t,e,n,i)})):(t.addEventListener(e,n,i),this.destroyEvents.push((function(){t.removeEventListener(e,n,i)})))}},{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}(),Ut=function(){function e(n){var r=this;t(this,e),this.art=n,this.keys={},this.art.option.hotkey&&this.art.on("ready",(function(){r.add(27,(function(){n.player.fullscreenWeb&&(n.player.fullscreenWeb=!1)})),r.add(32,(function(){n.player.toggle=!0})),r.add(37,(function(){n.player.seek=n.player.currentTime-5})),r.add(38,(function(){n.player.volume+=.1})),r.add(39,(function(){n.player.seek=n.player.currentTime+5})),r.add(40,(function(){n.player.volume-=.1})),r.init()}))}return n(e,[{key:"add",value:function(t,e){this.keys[t]?this.keys[t].push(e):this.keys[t]=[e]}},{key:"init",value:function(){var t=this;(0,this.art.events.proxy)(window,"keydown",(function(e){if(t.art.isFocus){var n=document.activeElement.tagName.toUpperCase(),r=document.activeElement.getAttribute("contenteditable");if("INPUT"!==n&&"TEXTAREA"!==n&&""!==r&&"true"!==r){var i=t.keys[e.keyCode];i&&(e.preventDefault(),i.forEach((function(t){return t()})),t.art.emit("hotkey",e))}}}))}}]),e}(),_t=function(){function e(n){var r=this;t(this,e),this.id=0,this.art=n,this.add=this.add.bind(this),this.art.on("ready",(function(){r.art.option.layers.forEach((function(t){r.add(t)}))}))}return n(e,[{key:"add",value:function(t,e){this.id+=1;var n=this.art.template.$layers;return rt(this.art,this,n,t,e,"layer")}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,y(e,"artplayer-layers-hide"),this.art.emit("layers:show")):(this.state=!1,h(e,"artplayer-layers-hide"),this.art.emit("layers:hide"))}}]),e}(),Xt=function(){function e(n){t(this,e),this.art=n,m(n.template.$loading,n.icons.loading)}return n(e,[{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-loading-show"),this.art.emit("loading:show")):(this.state=!1,y(e,"artplayer-loading-show"),this.art.emit("loading:hide"))}}]),e}(),Yt=function(){function e(n){t(this,e),this.art=n,this.timer=null}return n(e,[{key:"show",value:function(t){var e=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=this.art.template,o=i.$player,a=i.$noticeInner;this.state=!0,h(o,"artplayer-notice-show"),a.innerHTML=t instanceof Error?t.message.trim():t,clearTimeout(this.timer),n&&(this.timer=setTimeout((function(){e.hide()}),r)),this.art.emit("notice:show")}},{key:"hide",value:function(){var t=this.art.template.$player;this.state=!1,y(t,"artplayer-notice-show"),this.art.emit("notice:hide")}}]),e}(),Zt=function(){function e(n){t(this,e),this.art=n,m(n.template.$state,n.icons.state)}return n(e,[{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-mask-show"),this.art.emit("mask:show")):(this.state=!1,y(e,"artplayer-mask-show"),this.art.emit("mask:hide"))}}]),e}(),Jt=function e(n){var r=this;t(this,e);var i=Object.assign({loading:'\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n',state:'\n \n',play:'\n \n',pause:'\n \n',volume:'\n \n \n',volumeClose:'\n \n \n',subtitle:'\n \n \n',screenshot:'\n\t\n\n',setting:'\n \n \n',fullscreen:'\n\t\n\t\n\t\n\t\n',fullscreenWeb:'\n\t\n',pip:'\n \n',prev:'\n \n',next:'\n \n'},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 Gt(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;e'.concat(n.get("Flip"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n "),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 Kt(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 te(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e'.concat(n.get("Aspect ratio"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n '),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 ee(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 ne(t){return function(e){var n=e.i18n,r=e.player,i=e.events.proxy;return function(t){for(var e=1;e\n '.concat(n.get("Play speed"),': 1.0x\n \n
\n \n
\n '),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 re=function(){function e(n){var r=this;t(this,e),this.id=0,this.art=n,this.state=!1,n.option.setting&&(this.art.on("ready",(function(){r.init()})),this.art.on("blur",(function(){r.show=!1})))}return n(e,[{key:"init",value:function(){var t=this,e=this.art,n=e.option,r=e.template.$setting;(0,e.events.proxy)(r,"click",(function(e){e.target===r&&(t.show=!1)})),this.add(Qt({disable:!n.flip,name:"flip"})),this.add(te({disable:!n.aspectRatio,name:"aspectRatio"})),this.add(ne({disable:!n.playbackRate,name:"playbackRate"}))}},{key:"add",value:function(t,e){this.id+=1;var n=this.art.template.$settingBody;return rt(this.art,this,n,t,e,"setting")}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-setting-show"),this.art.emit("setting:show")):(this.state=!1,y(e,"artplayer-setting-show"),this.art.emit("setting:hide"))}}]),e}(),ie=function(){function e(n){t(this,e),this.art=n,this.name="artplayer_settings";var r=n.option,i=this.get("volume");i&&(r.volume=i)}return n(e,[{key:"get",value:function(t){var e=JSON.parse(window.localStorage.getItem(this.name))||{};return t?e[t]:{}}},{key:"set",value:function(t,e){var n=Object.assign({},this.get(),it({},t,e));window.localStorage.setItem(this.name,JSON.stringify(n))}},{key:"del",value:function(t){var e=this.get();delete e[t],window.localStorage.setItem(this.name,JSON.stringify(e))}},{key:"clean",value:function(){window.localStorage.removeItem(this.name)}}]),e}();function oe(t){var e=t.i18n,n=t.subtitle,r=t.events.proxy;return{title:"Subtitle",name:"subtitle",index:20,html:'\n
\n '.concat(e.get("Subtitle offset time"),': 0s\n
\n
\n \n
\n '),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("artplayerPluginSubtitleOffset",(function(t){n.update(),i.value!==t&&(i.value=t,o.innerText=t)}))}}}function ae(t){var e=t.constructor.utils.clamp,n=t.setting,r=t.notice,i=t.template,o=t.i18n,a=t.player;o.update({"zh-cn":{"Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},"zh-tw":{"Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"}}),n.add(oe);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("artplayerPluginSubtitleOffset",n)}else r.show("".concat(o.get("No subtitles found"))),t.emit("artplayerPluginSubtitleOffset",0)}}}function ce(t){var e=t.events.proxy,n=t.template,r=t.player;function i(t){if(t){var e=n.$video.canPlayType(t.type);if("maybe"===e||"probably"===e){var i=URL.createObjectURL(t);r.switchUrl(i,t.name)}else S(!1,"Playback of this file format is not supported")}}return e(n.$player,"dragover",(function(t){t.preventDefault()})),e(n.$player,"drop",(function(t){t.preventDefault(),i(t.dataTransfer.files[0])})),{name:"localVideo",attach:function(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(){i(n.files[0])}))}}}function se(t){var e=t.events.proxy,n=t.subtitle;return{name:"localSubtitle",attach:function(t){var r=m(t,'');g(t,"position","relative"),b(r,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(r,"change",(function(){!function(t){if(t){var r=D(t.name);if(["ass","vtt","srt"].includes(r)){var i=new FileReader;e(i,"load",(function(e){var i=e.target.result;switch(r){case"srt":var o=R($(i));n.switch(o,t.name);break;case"ass":var a=R(T(i));n.switch(a,t.name);break;case"vtt":var c=R(i);n.switch(c,t.name)}})),i.readAsText(t)}else S(!1,"Only supports subtitle files in .ass, .vtt and .srt format")}}(r.files[0])}))}}}function ue(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("controls:show",(function(){e.style.display="none"})),t.on("destroy",(function(){e.style.display="none"})),t.on("controls:hide",(function(){e.style.display="block"})),t.on("video:timeupdate",(function(){e.style.width="".concat(100*n.played,"%")}))}}),{name:"miniProgressBar"}}function le(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}}}function fe(t){var e=t.events,n=t.player,r=t.template,i=V((function(){var e=r.$player.getBoundingClientRect();e.top+e.height<=0&&!n.pip?(n.pip=!0,t.emit("artplayerPluginAutoPip",!0)):n.pip&&(n.pip=!1,t.emit("artplayerPluginAutoPip",!1))}),300);return e.proxy(window,"scroll",i),{name:"autoPip"}}var pe=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(ae),!i.isLive&&i.miniProgressBar&&this.add(ue),i.localVideo&&this.add(ce),i.localSubtitle&&this.add(se),i.networkMonitor&&this.add(le),i.autoPip&&this.add(fe),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 S(!q(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}(),de=function e(n){t(this,e);var r=n.option,i=n.events.proxy,o=n.template.$video;Y.video.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=I(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?(n.emit("beforeCustomType",a),c(o,r.url,n),n.emit("afterCustomType",a)):(n.emit("beforeAttachUrl",r.url),o.src=r.url,n.emit("afterAttachUrl",o.src))},he=0,ye=function(e){function r(e){var n;return t(this,r),(n=a(this,c(r).call(this))).option=l(F(r.option,e),X),n.isFocus=!1,n.isDestroy=!1,n.whitelist=new Z(o(n)),n.template=new J(o(n)),n.events=new Nt(o(n)),n.whitelist.state?(n.storage=new ie(o(n)),n.icons=new Jt(o(n)),n.i18n=new K(o(n)),n.notice=new Yt(o(n)),n.player=new nt(o(n)),n.layers=new _t(o(n)),n.controls=new Tt(o(n)),n.contextmenu=new Vt(o(n)),n.subtitle=new It(o(n)),n.info=new Bt(o(n)),n.loading=new Xt(o(n)),n.hotkey=new Ut(o(n)),n.mask=new Zt(o(n)),n.setting=new re(o(n)),n.plugins=new pe(o(n))):n.mobile=new de(o(n)),he+=1,n.id=he,r.instances.push(o(n)),console.log("%c ArtPlayer %c 3.1.18 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),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.1.18"}},{key:"env",get:function(){return'"production"'}},{key:"config",get:function(){return Y}},{key:"utils",get:function(){return U}},{key:"scheme",get:function(){return X}},{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(ye,"instances",{value:[]}),ye})); diff --git a/packages/artplayer/dist/artplayer.js b/packages/artplayer/dist/artplayer.js index 18d0d2d50..0c94e8dec 100644 --- a/packages/artplayer/dist/artplayer.js +++ b/packages/artplayer/dist/artplayer.js @@ -5,10 +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 P(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]")},x=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})),E=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 x(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 S(t,e){if(!t)throw new E(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 T(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 C(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 A=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 V(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 U=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:P,ArtPlayerError:E,errorHandle:S,srtToVtt:$,vttToBlob:R,assToVtt:T,getExt:D,downloadFile:C,hasOwnProperty:q,proxyPropertys:W,mergeDeep:F,sleep:H,debounce:V,throttle:B,clamp:I,secondToTime:N});function _(t,e,n){return S("string"===e||t instanceof Element,"".concat(n.join(".")," require 'string' or 'Element' type"))}var X={container:_,url:"string|function",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",autoPip:"boolean",networkMonitor:"boolean",plugins:["function"],whitelist:["string|function|regexp"],layers:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:_,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined"}],contextmenu:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:_,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:_,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined",position:function(t,e,n){var r=["top","left","right"];return S(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"},Y={video:{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"]}},Z=function e(n){var r=this;t(this,e);var i=n.constructor.kindOf,o=n.option.whitelist;this.userAgent=window.navigator.userAgent,this.isMobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(this.userAgent),this.state=!this.isMobile||o.some((function(t){switch(i(t)){case"string":return r.userAgent.indexOf(t)>-1;case"function":return t(r.userAgent);case"regexp":return t.test(r.userAgent);default:return!1}}))},J=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),S(this.$container,"No container element found by ".concat(n.option.container))),S(n.constructor.instances.every((function(t){return t.template.$container!==r.$container})),"Cannot mount multiple instances on the same dom element"),S(this.$container.clientWidth&&this.$container.clientHeight,"The width and height of the container cannot be 0"),n.whitelist.state?this.initDesktop():this.initMobile()}return n(e,[{key:"query",value:function(t){return p(t,this.$container)}},{key:"initDesktop",value:function(){this.$container.innerHTML='\n
\n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
Player version:
\n
3.1.18
\n
\n
\n
Video url:
\n
\n
\n
\n
Video volume:
\n
\n
\n
\n
Video time:
\n
\n
\n
\n
Video duration:
\n
\n
\n
\n
Video resolution:
\n
\n x \n
\n
\n
\n
[x]
\n
\n
\n
\n
×
\n
\n
\n
\n '),this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video"),this.$track=this.query(".artplayer-video track"),this.$subtitle=this.query(".artplayer-subtitle"),this.$danmuku=this.query(".artplayer-danmuku"),this.$bottom=this.query(".artplayer-bottom"),this.$progress=this.query(".artplayer-progress"),this.$controls=this.query(".artplayer-controls"),this.$controlsLeft=this.query(".artplayer-controls-left"),this.$controlsRight=this.query(".artplayer-controls-right"),this.$layers=this.query(".artplayer-layers"),this.$loading=this.query(".artplayer-loading"),this.$notice=this.query(".artplayer-notice"),this.$noticeInner=this.query(".artplayer-notice-inner"),this.$mask=this.query(".artplayer-mask"),this.$state=this.query(".artplayer-state"),this.$setting=this.query(".artplayer-setting"),this.$settingInner=this.query(".artplayer-setting-inner"),this.$settingBody=this.query(".artplayer-setting-body"),this.$info=this.query(".artplayer-info"),this.$infoPanel=this.query(".artplayer-info-panel"),this.$infoClose=this.query(".artplayer-info-close"),this.$pipHeader=this.query(".artplayer-pip-header"),this.$pipTitle=this.query(".artplayer-pip-title"),this.$pipClose=this.query(".artplayer-pip-close"),this.$contextmenu=this.query(".artplayer-contextmenu")}},{key:"initMobile",value:function(){this.$container.innerHTML='\n
\n \n
\n ',this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video")}},{key:"destroy",value:function(t){t?this.$container.innerHTML="":h(this.$player,"artplayer-destroy")}}]),e}(),G={"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:"正常","Switch video":"切换","Switch subtitle":"切换字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"网页全屏","Exit web fullscreen":"退出网页全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},Q={"About author":"關於作者","Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"影片翻轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide subtitle":"隱藏字幕","Show subtitle":"顯示字幕","Show setting":"顯示设置","Hide setting":"隱藏设置","Hide danmu":"隱藏彈幕","Show danmu":"顯示彈幕",Screenshot:"截圖","Play speed":"播放速度","Aspect ratio":"畫面比例",Default:"默認",Normal:"正常","Switch video":"切換","Switch subtitle":"切換字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"網頁全屏","Exit web fullscreen":"退出網頁全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},K=function(){function e(n){t(this,e),this.art=n,this.languages={"zh-cn":G,"zh-tw":Q},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=F(this.languages,t),this.init()}}]),e}();var tt=r((function(t){ -/*! - * screenfull - * v5.0.0 - 2019-09-09 - * (c) Sindre Sorhus; MIT License - */ -!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={};r1&&void 0!==arguments[1]?arguments[1]:"unknown";if(a!==o.$video.src){URL.revokeObjectURL(o.$video.src);var s=e.currentTime,u=e.playing;return e.attachUrl(a).then((function(){i.url=a,e.playbackRate=!1,e.aspectRatio=!1,t.on("ready",(function(){e.currentTime=s})),u&&(e.play=!0),r.show("".concat(n.get("Switch video"),": ").concat(c)),t.emit("switch",a)}))}return null}}),Object.defineProperty(e,"switchUrl",{value:function(a){var c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unknown";if(a!==o.$video.src){URL.revokeObjectURL(o.$video.src);var s=e.playing;return e.attachUrl(a).then((function(){i.url=a,e.playbackRate=!1,e.aspectRatio=!1,t.on("ready",(function(){e.currentTime=0})),s&&(e.play=!0),r.show("".concat(n.get("Switch video"),": ").concat(c)),t.emit("switch",a)}))}return null}})}(n,this),function(t,e){var n=t.template,r=n.$video,i=n.$player,o=t.i18n,a=t.notice;Object.defineProperty(e,"playbackRate",{get:function(){return i.dataset.playbackRate},set:function(n){if(n){var c=[.5,.75,1,1.25,1.5,1.75,2];if(S(c.includes(n),"'playbackRate' only accept ".concat(c.toString()," as parameters")),n===i.dataset.playbackRate)return;r.playbackRate=n,i.dataset.playbackRate=n,a.show("".concat(o.get("Rate"),": ").concat(1===n?o.get("Normal"):"".concat(n,"x"))),t.emit("playbackRateChange",n)}else e.playbackRate&&(e.playbackRate=1,delete i.dataset.playbackRate,t.emit("playbackRateRemove"))}}),Object.defineProperty(e,"playbackRateReset",{set:function(n){if(n){var r=i.dataset.playbackRate;r&&(e.playbackRate=Number(r),t.emit("playbackRateReset"))}}})}(n,this),function(t,e){var n=t.template,r=n.$video,i=n.$player,o=t.i18n,a=t.notice;Object.defineProperty(e,"aspectRatio",{get:function(){return i.dataset.aspectRatio||""},set:function(n){if(n){var c=["default","4:3","16:9"];if(S(c.includes(n),"'aspectRatio' only accept ".concat(c.toString()," as parameters")),"default"===n)e.aspectRatio=!1;else{var s=n.split(":"),u=r.videoWidth,l=r.videoHeight,f=i.clientWidth,p=i.clientHeight,d=u/l,h=s[0]/s[1];if(d>h){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"))}}),Object.defineProperty(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;Object.defineProperty(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}}}),Object.defineProperty(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)}}))}}),Object.defineProperty(e,"screenshot",{value:function(){var r=e.getScreenshotDataURL();r&&(C(r,"".concat(n.title||"artplayer","_").concat(N(i.currentTime),".png")),t.emit("screenshot",r))}})}(n,this),function(t,e){var n=t.i18n,r=t.notice,i=t.events.destroyEvents,o=t.template.$player,a=function(){t.emit("fullscreen:change",tt.isFullscreen)},c=function(){r.show(n.get("Does not support fullscreen"))};e.fullscreenIsEnabled&&(tt.on("change",a),tt.on("error",c),i.push((function(){tt.off("change",a),tt.off("error",c)}))),Object.defineProperty(e,"fullscreen",{get:function(){return tt.isFullscreen},set:function(n){e.fullscreenIsEnabled?n?(e.fullscreenWeb&&(e.fullscreenWeb=!1),tt.request(o).then((function(){h(o,"artplayer-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreen:enabled")}))):(e.fullscreenWeb&&(e.fullscreenWeb=!1),tt.exit().then((function(){y(o,"artplayer-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreen:exit")}))):c()}}),Object.defineProperty(e,"fullscreenToggle",{set:function(t){t&&(e.fullscreen=!e.fullscreen)}}),Object.defineProperty(e,"fullscreenIsEnabled",{get:function(){return tt.isEnabled}})}(n,this),function(t,e){var n=t.template.$player;Object.defineProperty(e,"fullscreenWeb",{get:function(){return v(n,"artplayer-web-fullscreen")},set:function(r){r?(e.fullscreen&&(e.fullscreen=!1),h(n,"artplayer-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWeb:enabled")):(e.fullscreen&&(e.fullscreen=!1),y(n,"artplayer-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWeb:exit"))}}),Object.defineProperty(e,"fullscreenWebToggle",{set:function(t){t&&(e.fullscreenWeb=!e.fullscreenWeb)}})}(n,this),et(n,this),function(t,e){var n=t.template.$video;Object.defineProperty(e,"loaded",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1)/n.duration:0}}),Object.defineProperty(e,"loadedTime",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1):0}})}(n,this),function(t,e){Object.defineProperty(e,"played",{get:function(){return t.template.$video.currentTime/t.template.$video.duration}})}(n,this),function(t,e){var n=t.template.$video;Object.defineProperty(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;Object.defineProperty(e,"autoSize",{get:function(){return v(r,"artplayer-auto-size")},set:function(e){if(e){var n=o.videoWidth,a=o.videoHeight,c=r.getBoundingClientRect(),s=c.width,u=c.height,l=n/a,f=s/u;if(h(r,"artplayer-auto-size"),f>l){g(i,"width","".concat(u*l/s*100,"%")),g(i,"height","100%")}else{var p=s/l/u*100;g(i,"width","100%"),g(i,"height","".concat(p,"%"))}t.emit("autoSizeChange")}else y(r,"artplayer-auto-size"),g(i,"width",null),g(i,"height",null),t.emit("autoSizeRemove")}})}(n,this),function(t,e){Object.defineProperty(e,"rect",{get:function(){return t.template.$player.getBoundingClientRect()}}),["bottom","height","left","right","top","width"].forEach((function(t){Object.defineProperty(e,t,{get:function(){return e.rect[t]}})})),Object.defineProperty(e,"x",{get:function(){return e.left+window.pageXOffset}}),Object.defineProperty(e,"y",{get:function(){return e.top+window.pageYOffset}})}(n,this),function(t,e){Object.defineProperty(e,"flip",{get:function(){return t.template.$player.dataset.flip},set:function(e){if(e){var n=["normal","horizontal","vertical"];S(n.includes(e),"'flip' only accept ".concat(n.toString()," as parameters")),t.template.$player.dataset.flip=e,t.emit("flipChange",e)}else delete t.template.$player.dataset.flip,t.emit("flipRemove")}})}(n,this),W(n,this)};function rt(t,e,n,r,i,o){var a="function"==typeof r?r(t):r;if(a.disable)return{};var c=e.id,s=a.name||"".concat(o).concat(c);S(!q(e,s),"Cannot create a component that already has the same name: ".concat(o," -> ").concat(s));var u=document.createElement("div");u.classList.value="art-".concat(o," art-").concat(o,"-").concat(s),a.html&&m(u,a.html),a.style&&b(u,a.style),a.tooltip&&P(u,a.tooltip);var l=Array.from(n.children);u.dataset.index=a.index||c;var f=l.find((function(t){return Number(t.dataset.index)>=Number(u.dataset.index)}));return f?f.insertAdjacentElement("beforebegin",u):m(n,u),a.click&&t.events.proxy(u,"click",(function(n){n.preventDefault(),a.click.call(t,e,n),t.emit("".concat(o,":click"),u)})),a.mounted&&a.mounted(u,e,t),i&&i(u,e,t),Object.defineProperty(e,s,{value:{get id(){return c},get $ref(){return u},set show(e){e?(g(u,"display","block"),t.emit("".concat(o,":show"),u)):(g(u,"display","none"),t.emit("".concat(o,":hide"),u))}}}),t.emit("".concat(o,":add"),a),e[s]}var it=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 ot(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 at(t){return function(e){return function(t){for(var e=1;e\n
\n
\n
\n
\n
\n \n '),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=I(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=ht(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=ht(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=ht(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=ht(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 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 mt(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 I(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"))}}P(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(l,"mousemove",(function(t){a&&(i.muted=!1,i.volume=f(t))})),n(document,"mouseup",(function(){a&&(a=!1)}))}})}}function jt(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 Pt(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 Et(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 St(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.innerHTML=o,c=e)}))}})}}var Tt=function(){function e(n){var r=this;t(this,e),this.id=0,this.art=n,this.art.on("ready",(function(){r.init()}))}return n(e,[{key:"init",value:function(){var t=this,e=this.art.option;this.add(yt({name:"progress",disable:e.isLive,position:"top",index:10})),this.add(xt({name:"thumbnails",disable:!e.thumbnails.url||e.isLive,position:"top",index:20})),this.add(pt({name:"playAndPause",disable:!1,position:"left",index:10})),this.add(Ot({name:"volume",disable:!1,position:"left",index:20})),this.add(bt({name:"time",disable:e.isLive,position:"left",index:30})),this.add(Rt({name:"quality",disable:0===e.quality.length,position:"right",index:10})),this.add(St({name:"screenshot",disable:!e.screenshot,position:"right",index:20})),this.add(mt({name:"subtitle",disable:!e.subtitle.url,position:"right",index:30})),this.add(Pt({name:"setting",disable:!e.setting,position:"right",index:40})),this.add(lt({name:"pip",disable:!e.pip,position:"right",index:50})),this.add(st({name:"fullscreenWeb",disable:!e.fullscreenWeb,position:"right",index:60})),this.add(at({name:"fullscreen",disable:!e.fullscreen,position:"right",index:70})),e.controls.forEach((function(e){t.add(e)}))}},{key:"add",value:function(t,e){var n,r="function"==typeof t?t(this.art):t,i=this.art.template,o=i.$progress,a=i.$controlsLeft,c=i.$controlsRight;switch(r.position){case"top":n=o;break;case"left":n=a;break;case"right":n=c}this.id+=1,S(r.position,"Controls option.position can not be empty");var s=rt(this.art,this,n,r,e,"control");return r.disable||"top"===r.position||s.$ref.firstElementChild&&"I"===s.$ref.firstElementChild.tagName||h(s.$ref,"art-control-onlyText"),s}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-controls-show"),this.art.emit("controls:show")):(this.state=!1,y(e,"artplayer-controls-show"),this.art.emit("controls:hide"))}}]),e}();function Dt(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 Ct(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e0.5\n 0.75\n ').concat(n.get("Normal"),'\n 1.25\n 1.5\n 2.0\n '),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,"current")}))}})}}function At(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){var n=e.i18n,r=e.player;return function(t){for(var e=1;e').concat(n.get("Default"),'\n 4:3\n 16:9\n '),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,"current")}))}})}}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 zt(t){return function(e){return function(t){for(var e=1;eArtPlayer 3.1.18'})}function Ft(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 Ht(t){return function(e){return function(t){for(var e=1;eu+s&&(h=s-d),o+p>l+c&&(y=c-p),g(r,"left","".concat(h,"px")),g(r,"top","".concat(y,"px"))}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-contextmenu-show"),this.art.emit("contextmenu:show")):(this.state=!1,y(e,"artplayer-contextmenu-show"),this.art.emit("contextmenu:hide"))}}]),e}(),Bt=function(){function e(n){var r=this;t(this,e),this.art=n,this.timer=null;var i=n.template,o=i.$infoPanel,a=i.$infoClose,c=n.events.proxy;this.types=d("[data-video]",o),c(a,"click",(function(){r.show=!1})),this.art.on("destroy",(function(){clearTimeout(r.timer)}))}return n(e,[{key:"readInfo",value:function(){var t=this.art.template.$video;this.types.forEach((function(e){var n=t[e.dataset.video];e.innerHTML="number"==typeof n?n.toFixed(2):n}))}},{key:"loop",value:function(){var t=this;this.readInfo(),this.timer=setTimeout((function(){t.readInfo(),t.loop()}),1e3)}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-info-show"),clearTimeout(this.timer),this.loop(),this.art.emit("info:show")):(this.state=!1,y(e,"artplayer-info-show"),clearTimeout(this.timer),this.art.emit("info:hide"))}}]),e}(),It=function(){function e(n){t(this,e),this.art=n,this.state=!0;var r=n.events.proxy,i=n.option.subtitle;b(n.template.$subtitle,i.style),r(this.textTrack,"cuechange",this.update.bind(this)),i.url&&this.init(i.url)}return n(e,[{key:"update",value:function(){var t=this.art.template.$subtitle;t.innerHTML="",this.activeCue&&(t.innerHTML=this.activeCue.text.split(/\r?\n/).map((function(t){return"

".concat(t,"

")})).join("")),this.art.emit("subtitle:update",t)}},{key:"switch",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unknown",r=this.art,i=r.i18n,o=r.notice;return this.init(t).then((function(t){return o.show("".concat(i.get("Switch subtitle"),": ").concat(n)),e.art.emit("subtitle:switch",t),t}))}},{key:"init",value:function(t){var e=this,n=this.art,r=n.notice,i=n.template,o=i.$subtitle,a=i.$track;return fetch(t).then((function(t){return t.text()})).then((function(e){switch(D(t)){case"srt":return R($(e));case"ass":return R(T(e));case"vtt":return R(e);default:return t}})).then((function(t){return o.innerHTML="",e.url===t?t:(URL.revokeObjectURL(e.url),a.src=t,t)})).catch((function(t){throw r.show(t),t}))}},{key:"toggle",value:function(){this.show=!this.state}},{key:"url",get:function(){return this.art.template.$track.src}},{key:"textTrack",get:function(){return this.art.template.$video.textTracks[0]}},{key:"activeCue",get:function(){return this.textTrack.activeCues[0]}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,y(e,"artplayer-subtitle-hide"),this.art.emit("subtitle:show")):(this.state=!1,h(e,"artplayer-subtitle-hide"),this.art.emit("subtitle:hide"))}}]),e}();var Nt=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.once("video:canplay",(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,"artplayer-hover"),t.emit("hoverenter")}),(function(){y(n,"artplayer-hover"),t.emit("hoverleave")}))}(n,r),function(t,e){var n=t.template,r=n.$player,i=n.$video,o=t.player,a=V((function(){h(r,"artplayer-hide-cursor"),y(r,"artplayer-hover"),t.controls.show=!1}),3e3);t.on("hoverleave",(function(){o.playing&&a()})),e.proxy(r,"mousemove",(function(e){a.clearTimeout(),y(r,"artplayer-hide-cursor"),t.controls.show=!0,!t.player.pip&&o.playing&&e.target===i&&a()}))}(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=B((function(){r.width===a&&r.height===c||(a=r.width,c=r.height,n.autoSize&&(t.player.fullscreen||t.player.fullscreenWeb||t.player.pip?t.player.autoSize=!1:t.player.autoSize=!0),t.player.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]:{};Array.isArray(e)?e.forEach((function(e){return r.proxy(t,e,n,i)})):(t.addEventListener(e,n,i),this.destroyEvents.push((function(){t.removeEventListener(e,n,i)})))}},{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}(),Ut=function(){function e(n){var r=this;t(this,e),this.art=n,this.keys={},this.art.option.hotkey&&this.art.on("ready",(function(){r.add(27,(function(){n.player.fullscreenWeb&&(n.player.fullscreenWeb=!1)})),r.add(32,(function(){n.player.toggle=!0})),r.add(37,(function(){n.player.seek=n.player.currentTime-5})),r.add(38,(function(){n.player.volume+=.1})),r.add(39,(function(){n.player.seek=n.player.currentTime+5})),r.add(40,(function(){n.player.volume-=.1})),r.init()}))}return n(e,[{key:"add",value:function(t,e){this.keys[t]?this.keys[t].push(e):this.keys[t]=[e]}},{key:"init",value:function(){var t=this;(0,this.art.events.proxy)(window,"keydown",(function(e){if(t.art.isFocus){var n=document.activeElement.tagName.toUpperCase(),r=document.activeElement.getAttribute("contenteditable");if("INPUT"!==n&&"TEXTAREA"!==n&&""!==r&&"true"!==r){var i=t.keys[e.keyCode];i&&(e.preventDefault(),i.forEach((function(t){return t()})),t.art.emit("hotkey",e))}}}))}}]),e}(),_t=function(){function e(n){var r=this;t(this,e),this.id=0,this.art=n,this.add=this.add.bind(this),this.art.on("ready",(function(){r.art.option.layers.forEach((function(t){r.add(t)}))}))}return n(e,[{key:"add",value:function(t,e){this.id+=1;var n=this.art.template.$layers;return rt(this.art,this,n,t,e,"layer")}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,y(e,"artplayer-layers-hide"),this.art.emit("layers:show")):(this.state=!1,h(e,"artplayer-layers-hide"),this.art.emit("layers:hide"))}}]),e}(),Xt=function(){function e(n){t(this,e),this.art=n,m(n.template.$loading,n.icons.loading)}return n(e,[{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-loading-show"),this.art.emit("loading:show")):(this.state=!1,y(e,"artplayer-loading-show"),this.art.emit("loading:hide"))}}]),e}(),Yt=function(){function e(n){t(this,e),this.art=n,this.timer=null}return n(e,[{key:"show",value:function(t){var e=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=this.art.template,o=i.$player,a=i.$noticeInner;this.state=!0,h(o,"artplayer-notice-show"),a.innerHTML=t instanceof Error?t.message.trim():t,clearTimeout(this.timer),n&&(this.timer=setTimeout((function(){e.hide()}),r)),this.art.emit("notice:show")}},{key:"hide",value:function(){var t=this.art.template.$player;this.state=!1,y(t,"artplayer-notice-show"),this.art.emit("notice:hide")}}]),e}(),Zt=function(){function e(n){t(this,e),this.art=n,m(n.template.$state,n.icons.state)}return n(e,[{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-mask-show"),this.art.emit("mask:show")):(this.state=!1,y(e,"artplayer-mask-show"),this.art.emit("mask:hide"))}}]),e}(),Jt=function e(n){var r=this;t(this,e);var i=Object.assign({loading:'\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n',state:'\n \n',play:'\n \n',pause:'\n \n',volume:'\n \n \n',volumeClose:'\n \n \n',subtitle:'\n \n \n',screenshot:'\n\t\n\n',setting:'\n \n \n',fullscreen:'\n\t\n\t\n\t\n\t\n',fullscreenWeb:'\n\t\n',pip:'\n \n',prev:'\n \n',next:'\n \n'},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 Gt(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;e'.concat(n.get("Flip"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n "),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 Kt(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 te(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e'.concat(n.get("Aspect ratio"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n '),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 ee(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 ne(t){return function(e){var n=e.i18n,r=e.player,i=e.events.proxy;return function(t){for(var e=1;e\n '.concat(n.get("Play speed"),': 1.0x\n \n
\n \n
\n '),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 re=function(){function e(n){var r=this;t(this,e),this.id=0,this.art=n,this.state=!1,n.option.setting&&(this.art.on("ready",(function(){r.init()})),this.art.on("blur",(function(){r.show=!1})))}return n(e,[{key:"init",value:function(){var t=this,e=this.art,n=e.option,r=e.template.$setting;(0,e.events.proxy)(r,"click",(function(e){e.target===r&&(t.show=!1)})),this.add(Qt({disable:!n.flip,name:"flip"})),this.add(te({disable:!n.aspectRatio,name:"aspectRatio"})),this.add(ne({disable:!n.playbackRate,name:"playbackRate"}))}},{key:"add",value:function(t,e){this.id+=1;var n=this.art.template.$settingBody;return rt(this.art,this,n,t,e,"setting")}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-setting-show"),this.art.emit("setting:show")):(this.state=!1,y(e,"artplayer-setting-show"),this.art.emit("setting:hide"))}}]),e}(),ie=function(){function e(n){t(this,e),this.art=n,this.name="artplayer_settings";var r=n.option,i=this.get("volume");i&&(r.volume=i)}return n(e,[{key:"get",value:function(t){var e=JSON.parse(window.localStorage.getItem(this.name))||{};return t?e[t]:{}}},{key:"set",value:function(t,e){var n=Object.assign({},this.get(),it({},t,e));window.localStorage.setItem(this.name,JSON.stringify(n))}},{key:"del",value:function(t){var e=this.get();delete e[t],window.localStorage.setItem(this.name,JSON.stringify(e))}},{key:"clean",value:function(){window.localStorage.removeItem(this.name)}}]),e}();function oe(t){var e=t.i18n,n=t.subtitle,r=t.events.proxy;return{title:"Subtitle",name:"subtitle",index:20,html:'\n
\n '.concat(e.get("Subtitle offset time"),': 0s\n
\n
\n \n
\n '),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("artplayerPluginSubtitleOffset",(function(t){n.update(),i.value!==t&&(i.value=t,o.innerText=t)}))}}}function ae(t){var e=t.constructor.utils.clamp,n=t.setting,r=t.notice,i=t.template,o=t.i18n,a=t.player;o.update({"zh-cn":{"Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},"zh-tw":{"Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"}}),n.add(oe);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("artplayerPluginSubtitleOffset",n)}else r.show("".concat(o.get("No subtitles found"))),t.emit("artplayerPluginSubtitleOffset",0)}}}function ce(t){var e=t.events.proxy,n=t.template,r=t.player;function i(t){if(t){var e=n.$video.canPlayType(t.type);if("maybe"===e||"probably"===e){var i=URL.createObjectURL(t);r.switchUrl(i,t.name)}else S(!1,"Playback of this file format is not supported")}}return e(n.$player,"dragover",(function(t){t.preventDefault()})),e(n.$player,"drop",(function(t){t.preventDefault(),i(t.dataTransfer.files[0])})),{name:"localVideo",attach:function(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(){i(n.files[0])}))}}}function se(t){var e=t.events.proxy,n=t.subtitle;return{name:"localSubtitle",attach:function(t){var r=m(t,'');g(t,"position","relative"),b(r,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(r,"change",(function(){!function(t){if(t){var r=D(t.name);if(["ass","vtt","srt"].includes(r)){var i=new FileReader;e(i,"load",(function(e){var i=e.target.result;switch(r){case"srt":var o=R($(i));n.switch(o,t.name);break;case"ass":var a=R(T(i));n.switch(a,t.name);break;case"vtt":var c=R(i);n.switch(c,t.name)}})),i.readAsText(t)}else S(!1,"Only supports subtitle files in .ass, .vtt and .srt format")}}(r.files[0])}))}}}function ue(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("controls:show",(function(){e.style.display="none"})),t.on("destroy",(function(){e.style.display="none"})),t.on("controls:hide",(function(){e.style.display="block"})),t.on("video:timeupdate",(function(){e.style.width="".concat(100*n.played,"%")}))}}),{name:"miniProgressBar"}}function le(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}}}function fe(t){var e=t.events,n=t.player,r=t.template,i=V((function(){var e=r.$player.getBoundingClientRect();e.top+e.height<=0&&!n.pip?(n.pip=!0,t.emit("artplayerPluginAutoPip",!0)):n.pip&&(n.pip=!1,t.emit("artplayerPluginAutoPip",!1))}),300);return e.proxy(window,"scroll",i),{name:"autoPip"}}var pe=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(ae),!i.isLive&&i.miniProgressBar&&this.add(ue),i.localVideo&&this.add(ce),i.localSubtitle&&this.add(se),i.networkMonitor&&this.add(le),i.autoPip&&this.add(fe),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 S(!q(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}(),de=function e(n){t(this,e);var r=n.option,i=n.events.proxy,o=n.template.$video;Y.video.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=I(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?(n.emit("beforeCustomType",a),c(o,r.url,n),n.emit("afterCustomType",a)):(n.emit("beforeAttachUrl",r.url),o.src=r.url,n.emit("afterAttachUrl",o.src))},he=0,ye=function(e){function r(e){var n;return t(this,r),(n=a(this,c(r).call(this))).option=l(F(r.option,e),X),n.isFocus=!1,n.isDestroy=!1,n.whitelist=new Z(o(n)),n.template=new J(o(n)),n.events=new Nt(o(n)),n.whitelist.state?(n.storage=new ie(o(n)),n.icons=new Jt(o(n)),n.i18n=new K(o(n)),n.notice=new Yt(o(n)),n.player=new nt(o(n)),n.layers=new _t(o(n)),n.controls=new Tt(o(n)),n.contextmenu=new Vt(o(n)),n.subtitle=new It(o(n)),n.info=new Bt(o(n)),n.loading=new Xt(o(n)),n.hotkey=new Ut(o(n)),n.mask=new Zt(o(n)),n.setting=new re(o(n)),n.plugins=new pe(o(n))):n.mobile=new de(o(n)),he+=1,n.id=he,r.instances.push(o(n)),console.log("%c ArtPlayer %c 3.1.18 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),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.1.18"}},{key:"env",get:function(){return'"production"'}},{key:"config",get:function(){return Y}},{key:"utils",get:function(){return U}},{key:"scheme",get:function(){return X}},{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(ye,"instances",{value:[]}),ye})); +!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 P(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]")},x=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})),E=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 x(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 S(t,e){if(!t)throw new E(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 T(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 C(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 A=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 V(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 U=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:P,ArtPlayerError:E,errorHandle:S,srtToVtt:$,vttToBlob:R,assToVtt:T,getExt:D,downloadFile:C,hasOwnProperty:q,proxyPropertys:W,mergeDeep:F,sleep:H,debounce:V,throttle:B,clamp:I,secondToTime:N});function _(t,e,n){return S("string"===e||t instanceof Element,"".concat(n.join(".")," require 'string' or 'Element' type"))}var X={container:_,url:"string|function",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",autoPip:"boolean",networkMonitor:"boolean",plugins:["function"],whitelist:["string|function|regexp"],layers:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:_,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined"}],contextmenu:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:_,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:_,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined",position:function(t,e,n){var r=["top","left","right"];return S(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"},Y={video:{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"]}},Z=function e(n){var r=this;t(this,e);var i=n.constructor.kindOf,o=n.option.whitelist;this.userAgent=window.navigator.userAgent,this.isMobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(this.userAgent),this.state=!this.isMobile||o.some((function(t){switch(i(t)){case"string":return r.userAgent.indexOf(t)>-1;case"function":return t(r.userAgent);case"regexp":return t.test(r.userAgent);default:return!1}}))},J=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),S(this.$container,"No container element found by ".concat(n.option.container))),S(n.constructor.instances.every((function(t){return t.template.$container!==r.$container})),"Cannot mount multiple instances on the same dom element"),S(this.$container.clientWidth&&this.$container.clientHeight,"The width and height of the container cannot be 0"),n.whitelist.state?this.initDesktop():this.initMobile()}return n(e,[{key:"query",value:function(t){return p(t,this.$container)}},{key:"initDesktop",value:function(){this.$container.innerHTML='\n
\n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
Player version:
\n
3.1.18
\n
\n
\n
Video url:
\n
\n
\n
\n
Video volume:
\n
\n
\n
\n
Video time:
\n
\n
\n
\n
Video duration:
\n
\n
\n
\n
Video resolution:
\n
\n x \n
\n
\n
\n
[x]
\n
\n
\n
\n
×
\n
\n
\n
\n '),this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video"),this.$track=this.query(".artplayer-video track"),this.$subtitle=this.query(".artplayer-subtitle"),this.$danmuku=this.query(".artplayer-danmuku"),this.$bottom=this.query(".artplayer-bottom"),this.$progress=this.query(".artplayer-progress"),this.$controls=this.query(".artplayer-controls"),this.$controlsLeft=this.query(".artplayer-controls-left"),this.$controlsRight=this.query(".artplayer-controls-right"),this.$layers=this.query(".artplayer-layers"),this.$loading=this.query(".artplayer-loading"),this.$notice=this.query(".artplayer-notice"),this.$noticeInner=this.query(".artplayer-notice-inner"),this.$mask=this.query(".artplayer-mask"),this.$state=this.query(".artplayer-state"),this.$setting=this.query(".artplayer-setting"),this.$settingInner=this.query(".artplayer-setting-inner"),this.$settingBody=this.query(".artplayer-setting-body"),this.$info=this.query(".artplayer-info"),this.$infoPanel=this.query(".artplayer-info-panel"),this.$infoClose=this.query(".artplayer-info-close"),this.$pipHeader=this.query(".artplayer-pip-header"),this.$pipTitle=this.query(".artplayer-pip-title"),this.$pipClose=this.query(".artplayer-pip-close"),this.$contextmenu=this.query(".artplayer-contextmenu")}},{key:"initMobile",value:function(){this.$container.innerHTML='\n
\n \n
\n ',this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video")}},{key:"destroy",value:function(t){t?this.$container.innerHTML="":h(this.$player,"artplayer-destroy")}}]),e}(),G={"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:"正常","Switch video":"切换","Switch subtitle":"切换字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"网页全屏","Exit web fullscreen":"退出网页全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},Q={"About author":"關於作者","Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"影片翻轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide subtitle":"隱藏字幕","Show subtitle":"顯示字幕","Show setting":"顯示设置","Hide setting":"隱藏设置","Hide danmu":"隱藏彈幕","Show danmu":"顯示彈幕",Screenshot:"截圖","Play speed":"播放速度","Aspect ratio":"畫面比例",Default:"默認",Normal:"正常","Switch video":"切換","Switch subtitle":"切換字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"網頁全屏","Exit web fullscreen":"退出網頁全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},K=function(){function e(n){t(this,e),this.art=n,this.languages={"zh-cn":G,"zh-tw":Q},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=F(this.languages,t),this.init()}}]),e}();var tt=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={};r1&&void 0!==arguments[1]?arguments[1]:"unknown";if(a!==o.$video.src){URL.revokeObjectURL(o.$video.src);var s=e.currentTime,u=e.playing;return e.attachUrl(a).then((function(){i.url=a,e.playbackRate=!1,e.aspectRatio=!1,t.on("ready",(function(){e.currentTime=s})),u&&(e.play=!0),r.show("".concat(n.get("Switch video"),": ").concat(c)),t.emit("switch",a)}))}return null}}),Object.defineProperty(e,"switchUrl",{value:function(a){var c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unknown";if(a!==o.$video.src){URL.revokeObjectURL(o.$video.src);var s=e.playing;return e.attachUrl(a).then((function(){i.url=a,e.playbackRate=!1,e.aspectRatio=!1,t.on("ready",(function(){e.currentTime=0})),s&&(e.play=!0),r.show("".concat(n.get("Switch video"),": ").concat(c)),t.emit("switch",a)}))}return null}})}(n,this),function(t,e){var n=t.template,r=n.$video,i=n.$player,o=t.i18n,a=t.notice;Object.defineProperty(e,"playbackRate",{get:function(){return i.dataset.playbackRate},set:function(n){if(n){var c=[.5,.75,1,1.25,1.5,1.75,2];if(S(c.includes(n),"'playbackRate' only accept ".concat(c.toString()," as parameters")),n===i.dataset.playbackRate)return;r.playbackRate=n,i.dataset.playbackRate=n,a.show("".concat(o.get("Rate"),": ").concat(1===n?o.get("Normal"):"".concat(n,"x"))),t.emit("playbackRateChange",n)}else e.playbackRate&&(e.playbackRate=1,delete i.dataset.playbackRate,t.emit("playbackRateRemove"))}}),Object.defineProperty(e,"playbackRateReset",{set:function(n){if(n){var r=i.dataset.playbackRate;r&&(e.playbackRate=Number(r),t.emit("playbackRateReset"))}}})}(n,this),function(t,e){var n=t.template,r=n.$video,i=n.$player,o=t.i18n,a=t.notice;Object.defineProperty(e,"aspectRatio",{get:function(){return i.dataset.aspectRatio||""},set:function(n){if(n){var c=["default","4:3","16:9"];if(S(c.includes(n),"'aspectRatio' only accept ".concat(c.toString()," as parameters")),"default"===n)e.aspectRatio=!1;else{var s=n.split(":"),u=r.videoWidth,l=r.videoHeight,f=i.clientWidth,p=i.clientHeight,d=u/l,h=s[0]/s[1];if(d>h){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"))}}),Object.defineProperty(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;Object.defineProperty(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}}}),Object.defineProperty(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)}}))}}),Object.defineProperty(e,"screenshot",{value:function(){var r=e.getScreenshotDataURL();r&&(C(r,"".concat(n.title||"artplayer","_").concat(N(i.currentTime),".png")),t.emit("screenshot",r))}})}(n,this),function(t,e){var n=t.i18n,r=t.notice,i=t.events.destroyEvents,o=t.template.$player,a=function(){t.emit("fullscreen:change",tt.isFullscreen)},c=function(){r.show(n.get("Does not support fullscreen"))};e.fullscreenIsEnabled&&(tt.on("change",a),tt.on("error",c),i.push((function(){tt.off("change",a),tt.off("error",c)}))),Object.defineProperty(e,"fullscreen",{get:function(){return tt.isFullscreen},set:function(n){e.fullscreenIsEnabled?n?(e.fullscreenWeb&&(e.fullscreenWeb=!1),tt.request(o).then((function(){h(o,"artplayer-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreen:enabled")}))):(e.fullscreenWeb&&(e.fullscreenWeb=!1),tt.exit().then((function(){y(o,"artplayer-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreen:exit")}))):c()}}),Object.defineProperty(e,"fullscreenToggle",{set:function(t){t&&(e.fullscreen=!e.fullscreen)}}),Object.defineProperty(e,"fullscreenIsEnabled",{get:function(){return tt.isEnabled}})}(n,this),function(t,e){var n=t.template.$player;Object.defineProperty(e,"fullscreenWeb",{get:function(){return v(n,"artplayer-web-fullscreen")},set:function(r){r?(e.fullscreen&&(e.fullscreen=!1),h(n,"artplayer-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWeb:enabled")):(e.fullscreen&&(e.fullscreen=!1),y(n,"artplayer-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWeb:exit"))}}),Object.defineProperty(e,"fullscreenWebToggle",{set:function(t){t&&(e.fullscreenWeb=!e.fullscreenWeb)}})}(n,this),et(n,this),function(t,e){var n=t.template.$video;Object.defineProperty(e,"loaded",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1)/n.duration:0}}),Object.defineProperty(e,"loadedTime",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1):0}})}(n,this),function(t,e){Object.defineProperty(e,"played",{get:function(){return t.template.$video.currentTime/t.template.$video.duration}})}(n,this),function(t,e){var n=t.template.$video;Object.defineProperty(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;Object.defineProperty(e,"autoSize",{get:function(){return v(r,"artplayer-auto-size")},set:function(e){if(e){var n=o.videoWidth,a=o.videoHeight,c=r.getBoundingClientRect(),s=c.width,u=c.height,l=n/a,f=s/u;if(h(r,"artplayer-auto-size"),f>l){g(i,"width","".concat(u*l/s*100,"%")),g(i,"height","100%")}else{var p=s/l/u*100;g(i,"width","100%"),g(i,"height","".concat(p,"%"))}t.emit("autoSizeChange")}else y(r,"artplayer-auto-size"),g(i,"width",null),g(i,"height",null),t.emit("autoSizeRemove")}})}(n,this),function(t,e){Object.defineProperty(e,"rect",{get:function(){return t.template.$player.getBoundingClientRect()}}),["bottom","height","left","right","top","width"].forEach((function(t){Object.defineProperty(e,t,{get:function(){return e.rect[t]}})})),Object.defineProperty(e,"x",{get:function(){return e.left+window.pageXOffset}}),Object.defineProperty(e,"y",{get:function(){return e.top+window.pageYOffset}})}(n,this),function(t,e){Object.defineProperty(e,"flip",{get:function(){return t.template.$player.dataset.flip},set:function(e){if(e){var n=["normal","horizontal","vertical"];S(n.includes(e),"'flip' only accept ".concat(n.toString()," as parameters")),t.template.$player.dataset.flip=e,t.emit("flipChange",e)}else delete t.template.$player.dataset.flip,t.emit("flipRemove")}})}(n,this),W(n,this)};function rt(t,e,n,r,i,o){var a="function"==typeof r?r(t):r;if(a.disable)return{};var c=e.id,s=a.name||"".concat(o).concat(c);S(!q(e,s),"Cannot create a component that already has the same name: ".concat(o," -> ").concat(s));var u=document.createElement("div");u.classList.value="art-".concat(o," art-").concat(o,"-").concat(s),a.html&&m(u,a.html),a.style&&b(u,a.style),a.tooltip&&P(u,a.tooltip);var l=Array.from(n.children);u.dataset.index=a.index||c;var f=l.find((function(t){return Number(t.dataset.index)>=Number(u.dataset.index)}));return f?f.insertAdjacentElement("beforebegin",u):m(n,u),a.click&&t.events.proxy(u,"click",(function(n){n.preventDefault(),a.click.call(t,e,n),t.emit("".concat(o,":click"),u)})),a.mounted&&a.mounted(u,e,t),i&&i(u,e,t),Object.defineProperty(e,s,{value:{get id(){return c},get $ref(){return u},set show(e){e?(g(u,"display","block"),t.emit("".concat(o,":show"),u)):(g(u,"display","none"),t.emit("".concat(o,":hide"),u))}}}),t.emit("".concat(o,":add"),a),e[s]}var it=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 ot(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 at(t){return function(e){return function(t){for(var e=1;e\n
\n
\n
\n
\n
\n \n '),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=I(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=ht(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=ht(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=ht(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=ht(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 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 mt(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 I(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"))}}P(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(l,"mousemove",(function(t){a&&(i.muted=!1,i.volume=f(t))})),n(document,"mouseup",(function(){a&&(a=!1)}))}})}}function jt(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 Pt(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 Et(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 St(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.innerHTML=o,c=e)}))}})}}var Tt=function(){function e(n){var r=this;t(this,e),this.id=0,this.art=n,this.art.on("ready",(function(){r.init()}))}return n(e,[{key:"init",value:function(){var t=this,e=this.art.option;this.add(yt({name:"progress",disable:e.isLive,position:"top",index:10})),this.add(xt({name:"thumbnails",disable:!e.thumbnails.url||e.isLive,position:"top",index:20})),this.add(pt({name:"playAndPause",disable:!1,position:"left",index:10})),this.add(Ot({name:"volume",disable:!1,position:"left",index:20})),this.add(bt({name:"time",disable:e.isLive,position:"left",index:30})),this.add(Rt({name:"quality",disable:0===e.quality.length,position:"right",index:10})),this.add(St({name:"screenshot",disable:!e.screenshot,position:"right",index:20})),this.add(mt({name:"subtitle",disable:!e.subtitle.url,position:"right",index:30})),this.add(Pt({name:"setting",disable:!e.setting,position:"right",index:40})),this.add(lt({name:"pip",disable:!e.pip,position:"right",index:50})),this.add(st({name:"fullscreenWeb",disable:!e.fullscreenWeb,position:"right",index:60})),this.add(at({name:"fullscreen",disable:!e.fullscreen,position:"right",index:70})),e.controls.forEach((function(e){t.add(e)}))}},{key:"add",value:function(t,e){var n,r="function"==typeof t?t(this.art):t,i=this.art.template,o=i.$progress,a=i.$controlsLeft,c=i.$controlsRight;switch(r.position){case"top":n=o;break;case"left":n=a;break;case"right":n=c}this.id+=1,S(r.position,"Controls option.position can not be empty");var s=rt(this.art,this,n,r,e,"control");return r.disable||"top"===r.position||s.$ref.firstElementChild&&"I"===s.$ref.firstElementChild.tagName||h(s.$ref,"art-control-onlyText"),s}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-controls-show"),this.art.emit("controls:show")):(this.state=!1,y(e,"artplayer-controls-show"),this.art.emit("controls:hide"))}}]),e}();function Dt(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 Ct(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e0.5\n 0.75\n ').concat(n.get("Normal"),'\n 1.25\n 1.5\n 2.0\n '),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,"current")}))}})}}function At(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){var n=e.i18n,r=e.player;return function(t){for(var e=1;e').concat(n.get("Default"),'\n 4:3\n 16:9\n '),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,"current")}))}})}}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 zt(t){return function(e){return function(t){for(var e=1;eArtPlayer 3.1.18'})}function Ft(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 Ht(t){return function(e){return function(t){for(var e=1;eu+s&&(h=s-d),o+p>l+c&&(y=c-p),g(r,"left","".concat(h,"px")),g(r,"top","".concat(y,"px"))}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-contextmenu-show"),this.art.emit("contextmenu:show")):(this.state=!1,y(e,"artplayer-contextmenu-show"),this.art.emit("contextmenu:hide"))}}]),e}(),Bt=function(){function e(n){var r=this;t(this,e),this.art=n,this.timer=null;var i=n.template,o=i.$infoPanel,a=i.$infoClose,c=n.events.proxy;this.types=d("[data-video]",o),c(a,"click",(function(){r.show=!1})),this.art.on("destroy",(function(){clearTimeout(r.timer)}))}return n(e,[{key:"readInfo",value:function(){var t=this.art.template.$video;this.types.forEach((function(e){var n=t[e.dataset.video];e.innerHTML="number"==typeof n?n.toFixed(2):n}))}},{key:"loop",value:function(){var t=this;this.readInfo(),this.timer=setTimeout((function(){t.readInfo(),t.loop()}),1e3)}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-info-show"),clearTimeout(this.timer),this.loop(),this.art.emit("info:show")):(this.state=!1,y(e,"artplayer-info-show"),clearTimeout(this.timer),this.art.emit("info:hide"))}}]),e}(),It=function(){function e(n){t(this,e),this.art=n,this.state=!0;var r=n.events.proxy,i=n.option.subtitle;b(n.template.$subtitle,i.style),r(this.textTrack,"cuechange",this.update.bind(this)),i.url&&this.init(i.url)}return n(e,[{key:"update",value:function(){var t=this.art.template.$subtitle;t.innerHTML="",this.activeCue&&(t.innerHTML=this.activeCue.text.split(/\r?\n/).map((function(t){return"

".concat(t,"

")})).join("")),this.art.emit("subtitle:update",t)}},{key:"switch",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unknown",r=this.art,i=r.i18n,o=r.notice;return this.init(t).then((function(t){return o.show("".concat(i.get("Switch subtitle"),": ").concat(n)),e.art.emit("subtitle:switch",t),t}))}},{key:"init",value:function(t){var e=this,n=this.art,r=n.notice,i=n.template,o=i.$subtitle,a=i.$track;return fetch(t).then((function(t){return t.text()})).then((function(e){switch(D(t)){case"srt":return R($(e));case"ass":return R(T(e));case"vtt":return R(e);default:return t}})).then((function(t){return o.innerHTML="",e.url===t?t:(URL.revokeObjectURL(e.url),a.src=t,t)})).catch((function(t){throw r.show(t),t}))}},{key:"toggle",value:function(){this.show=!this.state}},{key:"url",get:function(){return this.art.template.$track.src}},{key:"textTrack",get:function(){return this.art.template.$video.textTracks[0]}},{key:"activeCue",get:function(){return this.textTrack.activeCues[0]}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,y(e,"artplayer-subtitle-hide"),this.art.emit("subtitle:show")):(this.state=!1,h(e,"artplayer-subtitle-hide"),this.art.emit("subtitle:hide"))}}]),e}();var Nt=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.once("video:canplay",(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,"artplayer-hover"),t.emit("hoverenter")}),(function(){y(n,"artplayer-hover"),t.emit("hoverleave")}))}(n,r),function(t,e){var n=t.template,r=n.$player,i=n.$video,o=t.player,a=V((function(){h(r,"artplayer-hide-cursor"),y(r,"artplayer-hover"),t.controls.show=!1}),3e3);t.on("hoverleave",(function(){o.playing&&a()})),e.proxy(r,"mousemove",(function(e){a.clearTimeout(),y(r,"artplayer-hide-cursor"),t.controls.show=!0,!t.player.pip&&o.playing&&e.target===i&&a()}))}(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=B((function(){r.width===a&&r.height===c||(a=r.width,c=r.height,n.autoSize&&(t.player.fullscreen||t.player.fullscreenWeb||t.player.pip?t.player.autoSize=!1:t.player.autoSize=!0),t.player.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]:{};Array.isArray(e)?e.forEach((function(e){return r.proxy(t,e,n,i)})):(t.addEventListener(e,n,i),this.destroyEvents.push((function(){t.removeEventListener(e,n,i)})))}},{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}(),Ut=function(){function e(n){var r=this;t(this,e),this.art=n,this.keys={},this.art.option.hotkey&&this.art.on("ready",(function(){r.add(27,(function(){n.player.fullscreenWeb&&(n.player.fullscreenWeb=!1)})),r.add(32,(function(){n.player.toggle=!0})),r.add(37,(function(){n.player.seek=n.player.currentTime-5})),r.add(38,(function(){n.player.volume+=.1})),r.add(39,(function(){n.player.seek=n.player.currentTime+5})),r.add(40,(function(){n.player.volume-=.1})),r.init()}))}return n(e,[{key:"add",value:function(t,e){this.keys[t]?this.keys[t].push(e):this.keys[t]=[e]}},{key:"init",value:function(){var t=this;(0,this.art.events.proxy)(window,"keydown",(function(e){if(t.art.isFocus){var n=document.activeElement.tagName.toUpperCase(),r=document.activeElement.getAttribute("contenteditable");if("INPUT"!==n&&"TEXTAREA"!==n&&""!==r&&"true"!==r){var i=t.keys[e.keyCode];i&&(e.preventDefault(),i.forEach((function(t){return t()})),t.art.emit("hotkey",e))}}}))}}]),e}(),_t=function(){function e(n){var r=this;t(this,e),this.id=0,this.art=n,this.add=this.add.bind(this),this.art.on("ready",(function(){r.art.option.layers.forEach((function(t){r.add(t)}))}))}return n(e,[{key:"add",value:function(t,e){this.id+=1;var n=this.art.template.$layers;return rt(this.art,this,n,t,e,"layer")}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,y(e,"artplayer-layers-hide"),this.art.emit("layers:show")):(this.state=!1,h(e,"artplayer-layers-hide"),this.art.emit("layers:hide"))}}]),e}(),Xt=function(){function e(n){t(this,e),this.art=n,m(n.template.$loading,n.icons.loading)}return n(e,[{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-loading-show"),this.art.emit("loading:show")):(this.state=!1,y(e,"artplayer-loading-show"),this.art.emit("loading:hide"))}}]),e}(),Yt=function(){function e(n){t(this,e),this.art=n,this.timer=null}return n(e,[{key:"show",value:function(t){var e=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=this.art.template,o=i.$player,a=i.$noticeInner;this.state=!0,h(o,"artplayer-notice-show"),a.innerHTML=t instanceof Error?t.message.trim():t,clearTimeout(this.timer),n&&(this.timer=setTimeout((function(){e.hide()}),r)),this.art.emit("notice:show")}},{key:"hide",value:function(){var t=this.art.template.$player;this.state=!1,y(t,"artplayer-notice-show"),this.art.emit("notice:hide")}}]),e}(),Zt=function(){function e(n){t(this,e),this.art=n,m(n.template.$state,n.icons.state)}return n(e,[{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-mask-show"),this.art.emit("mask:show")):(this.state=!1,y(e,"artplayer-mask-show"),this.art.emit("mask:hide"))}}]),e}(),Jt=function e(n){var r=this;t(this,e);var i=Object.assign({loading:'\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n',state:'\n \n',play:'\n \n',pause:'\n \n',volume:'\n \n \n',volumeClose:'\n \n \n',subtitle:'\n \n \n',screenshot:'\n\t\n\n',setting:'\n \n \n',fullscreen:'\n\t\n\t\n\t\n\t\n',fullscreenWeb:'\n\t\n',pip:'\n \n',prev:'\n \n',next:'\n \n'},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 Gt(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;e'.concat(n.get("Flip"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n "),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 Kt(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 te(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e'.concat(n.get("Aspect ratio"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n '),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 ee(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 ne(t){return function(e){var n=e.i18n,r=e.player,i=e.events.proxy;return function(t){for(var e=1;e\n '.concat(n.get("Play speed"),': 1.0x\n \n
\n \n
\n '),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 re=function(){function e(n){var r=this;t(this,e),this.id=0,this.art=n,this.state=!1,n.option.setting&&(this.art.on("ready",(function(){r.init()})),this.art.on("blur",(function(){r.show=!1})))}return n(e,[{key:"init",value:function(){var t=this,e=this.art,n=e.option,r=e.template.$setting;(0,e.events.proxy)(r,"click",(function(e){e.target===r&&(t.show=!1)})),this.add(Qt({disable:!n.flip,name:"flip"})),this.add(te({disable:!n.aspectRatio,name:"aspectRatio"})),this.add(ne({disable:!n.playbackRate,name:"playbackRate"}))}},{key:"add",value:function(t,e){this.id+=1;var n=this.art.template.$settingBody;return rt(this.art,this,n,t,e,"setting")}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-setting-show"),this.art.emit("setting:show")):(this.state=!1,y(e,"artplayer-setting-show"),this.art.emit("setting:hide"))}}]),e}(),ie=function(){function e(n){t(this,e),this.art=n,this.name="artplayer_settings";var r=n.option,i=this.get("volume");i&&(r.volume=i)}return n(e,[{key:"get",value:function(t){var e=JSON.parse(window.localStorage.getItem(this.name))||{};return t?e[t]:{}}},{key:"set",value:function(t,e){var n=Object.assign({},this.get(),it({},t,e));window.localStorage.setItem(this.name,JSON.stringify(n))}},{key:"del",value:function(t){var e=this.get();delete e[t],window.localStorage.setItem(this.name,JSON.stringify(e))}},{key:"clean",value:function(){window.localStorage.removeItem(this.name)}}]),e}();function oe(t){var e=t.i18n,n=t.subtitle,r=t.events.proxy;return{title:"Subtitle",name:"subtitle",index:20,html:'\n
\n '.concat(e.get("Subtitle offset time"),': 0s\n
\n
\n \n
\n '),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("artplayerPluginSubtitleOffset",(function(t){n.update(),i.value!==t&&(i.value=t,o.innerText=t)}))}}}function ae(t){var e=t.constructor.utils.clamp,n=t.setting,r=t.notice,i=t.template,o=t.i18n,a=t.player;o.update({"zh-cn":{"Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},"zh-tw":{"Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"}}),n.add(oe);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("artplayerPluginSubtitleOffset",n)}else r.show("".concat(o.get("No subtitles found"))),t.emit("artplayerPluginSubtitleOffset",0)}}}function ce(t){var e=t.events.proxy,n=t.template,r=t.player;function i(t){if(t){var e=n.$video.canPlayType(t.type);if("maybe"===e||"probably"===e){var i=URL.createObjectURL(t);r.switchUrl(i,t.name)}else S(!1,"Playback of this file format is not supported")}}return e(n.$player,"dragover",(function(t){t.preventDefault()})),e(n.$player,"drop",(function(t){t.preventDefault(),i(t.dataTransfer.files[0])})),{name:"localVideo",attach:function(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(){i(n.files[0])}))}}}function se(t){var e=t.events.proxy,n=t.subtitle;return{name:"localSubtitle",attach:function(t){var r=m(t,'');g(t,"position","relative"),b(r,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(r,"change",(function(){!function(t){if(t){var r=D(t.name);if(["ass","vtt","srt"].includes(r)){var i=new FileReader;e(i,"load",(function(e){var i=e.target.result;switch(r){case"srt":var o=R($(i));n.switch(o,t.name);break;case"ass":var a=R(T(i));n.switch(a,t.name);break;case"vtt":var c=R(i);n.switch(c,t.name)}})),i.readAsText(t)}else S(!1,"Only supports subtitle files in .ass, .vtt and .srt format")}}(r.files[0])}))}}}function ue(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("controls:show",(function(){e.style.display="none"})),t.on("destroy",(function(){e.style.display="none"})),t.on("controls:hide",(function(){e.style.display="block"})),t.on("video:timeupdate",(function(){e.style.width="".concat(100*n.played,"%")}))}}),{name:"miniProgressBar"}}function le(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}}}function fe(t){var e=t.events,n=t.player,r=t.template,i=V((function(){var e=r.$player.getBoundingClientRect();e.top+e.height<=0&&!n.pip?(n.pip=!0,t.emit("artplayerPluginAutoPip",!0)):n.pip&&(n.pip=!1,t.emit("artplayerPluginAutoPip",!1))}),300);return e.proxy(window,"scroll",i),{name:"autoPip"}}var pe=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(ae),!i.isLive&&i.miniProgressBar&&this.add(ue),i.localVideo&&this.add(ce),i.localSubtitle&&this.add(se),i.networkMonitor&&this.add(le),i.autoPip&&this.add(fe),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 S(!q(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}(),de=function e(n){t(this,e);var r=n.option,i=n.events.proxy,o=n.template.$video;Y.video.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=I(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?(n.emit("beforeCustomType",a),c(o,r.url,n),n.emit("afterCustomType",a)):(n.emit("beforeAttachUrl",r.url),o.src=r.url,n.emit("afterAttachUrl",o.src))},he=0,ye=function(e){function r(e){var n;return t(this,r),(n=a(this,c(r).call(this))).option=l(F(r.option,e),X),n.isFocus=!1,n.isDestroy=!1,n.whitelist=new Z(o(n)),n.template=new J(o(n)),n.events=new Nt(o(n)),n.whitelist.state?(n.storage=new ie(o(n)),n.icons=new Jt(o(n)),n.i18n=new K(o(n)),n.notice=new Yt(o(n)),n.player=new nt(o(n)),n.layers=new _t(o(n)),n.controls=new Tt(o(n)),n.contextmenu=new Vt(o(n)),n.subtitle=new It(o(n)),n.info=new Bt(o(n)),n.loading=new Xt(o(n)),n.hotkey=new Ut(o(n)),n.mask=new Zt(o(n)),n.setting=new re(o(n)),n.plugins=new pe(o(n))):n.mobile=new de(o(n)),he+=1,n.id=he,r.instances.push(o(n)),console.log("%c ArtPlayer %c 3.1.18 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),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.1.18"}},{key:"env",get:function(){return'"production"'}},{key:"config",get:function(){return Y}},{key:"utils",get:function(){return U}},{key:"scheme",get:function(){return X}},{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(ye,"instances",{value:[]}),ye})); diff --git a/scripts/creatRollupConfig.js b/scripts/creatRollupConfig.js index d7b42e9cc..c25e125a7 100644 --- a/scripts/creatRollupConfig.js +++ b/scripts/creatRollupConfig.js @@ -87,6 +87,9 @@ module.exports = function creatRollupConfig(projectPath) { terser({ output: { preamble: banner, + comments: function() { + return false; + }, }, }), isProd &&