diff --git a/.size-snapshot.json b/.size-snapshot.json index b96ac5722..a57cdef0d 100644 --- a/.size-snapshot.json +++ b/.size-snapshot.json @@ -1,8 +1,8 @@ { "packages/artplayer/dist/artplayer.js": { - "bundled": 162568, - "minified": 86367, - "gzipped": 21735 + "bundled": 162888, + "minified": 86687, + "gzipped": 21743 }, "packages/artplayer-plugin-backlight/dist/artplayer-plugin-backlight.js": { "bundled": 4642, diff --git a/dist/artplayer.css b/dist/artplayer.css index fc25c3e21..b21abf5ef 100644 --- a/dist/artplayer.css +++ b/dist/artplayer.css @@ -1,4 +1,4 @@ -.art-video-player{display:-webkit-box;display:-ms-flexbox;display:flex;position:relative;margin:0 auto;z-index:10;width:100%;height:100%;outline:0;zoom:1;font-family:Roboto,Arial,Helvetica,sans-serif;color:#eee;text-align:left;direction:ltr;font-size:14px;line-height:1.3;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-touch-action:manipulation;touch-action:manipulation;-ms-high-contrast-adjust:none}.art-video-player *{margin:0;padding:0;-webkit-box-sizing:border-box;box-sizing:border-box}.art-video-player ::-webkit-scrollbar{width:5px}.art-video-player ::-webkit-scrollbar-thumb{background-color:#666}.art-video-player ::-webkit-scrollbar-thumb:hover{background-color:#ccc}.art-video-player .art-icon{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;line-height:1.5}.art-video-player .art-icon svg{fill:#fff}.art-video-player>object{display:block;position:absolute;top:0;left:0;height:100%;width:100%;overflow:hidden;pointer-events:none;z-index:-1}@supports ((-webkit-backdrop-filter:initial) or (backdrop-filter:initial)){.art-video-player .art-backdrop-filter{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:rgba(0,0,0,.7)!important}} +.art-video-player{display:-webkit-box;display:-ms-flexbox;display:flex;position:relative;margin:0 auto;z-index:10;width:100%;height:100%;outline:0;zoom:1;font-family:Roboto,Arial,Helvetica,sans-serif;color:#eee;text-align:left;direction:ltr;font-size:14px;line-height:1.3;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-touch-action:manipulation;touch-action:manipulation;-ms-high-contrast-adjust:none}.art-video-player *{margin:0;padding:0;-webkit-box-sizing:border-box;box-sizing:border-box}.art-video-player ::-webkit-scrollbar{width:5px}.art-video-player ::-webkit-scrollbar-thumb{background-color:#666}.art-video-player ::-webkit-scrollbar-thumb:hover{background-color:#ccc}.art-video-player .art-icon{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;line-height:1.5}.art-video-player .art-icon svg{fill:#fff}.art-video-player img{max-width:100%;vertical-align:top}.art-video-player>object{display:block;position:absolute;top:0;left:0;height:100%;width:100%;overflow:hidden;pointer-events:none;z-index:-1}@supports ((-webkit-backdrop-filter:initial) or (backdrop-filter:initial)){.art-video-player .art-backdrop-filter{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:rgba(0,0,0,.7)!important}} .art-video-player .art-video{position:absolute;z-index:10;left:0;top:0;right:0;bottom:0;width:100%;height:100%;background-color:#000;cursor:pointer} .art-video-player .art-subtitle{display:none;position:absolute;z-index:20;bottom:40px;width:100%;padding:0 20px;text-align:center;color:#fff;font-size:20px;pointer-events:none;text-shadow:.5px .5px .5px rgba(0,0,0,.5)}.art-video-player .art-subtitle p{margin:5px 0}.art-video-player.art-subtitle-show .art-subtitle{display:block} .art-video-player .art-danmuku{position:absolute;z-index:30;left:0;top:0;right:0;bottom:0;width:100%;height:100%;overflow:hidden;pointer-events:none} diff --git a/dist/artplayer.js b/dist/artplayer.js index 9286d28c2..3205a6e6c 100644 --- a/dist/artplayer.js +++ b/dist/artplayer.js @@ -5,4 +5,4 @@ * Released under the MIT License. */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Artplayer=e()}(this,(function(){"use strict";var t=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function e(t,e){for(var n=0;n1?n-1:0),i=1;i1&&void 0!==arguments[1]?arguments[1]:document).querySelector(t)}function d(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(e.querySelectorAll(t))}function h(t,e){return t.classList.add(e)}function y(t,e){return t.classList.remove(e)}function v(t,e){return t.classList.contains(e)}function m(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function g(t,e,n){return t.style[e]=n,t}function b(t,e){return Object.keys(e).forEach((function(n){g(t,n,e[n])})),t}function w(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=window.getComputedStyle(t,null).getPropertyValue(e);return n?parseFloat(r):r}function O(t){return Array.from(t.parentElement.children).filter((function(e){return e!==t}))}function x(t,e){O(t).forEach((function(t){return y(t,e)})),h(t,e)}function k(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 j=function(t){return-1!==Function.toString.call(t).indexOf("[native code]")},P=r((function(t){function e(n,r,i){return!function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}()?t.exports=e=function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&s(i,n.prototype),i}:t.exports=e=Reflect.construct,e.apply(null,arguments)}t.exports=e})),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||!j(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,e)}function e(){return P(t,arguments,c(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),s(e,t)},e(n)}t.exports=e}))(Error));function 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 L=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e1?e-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(e){return setTimeout(e,t)}))}function I(t,e,n){var r;function i(){for(var i=arguments.length,o=new Array(i),a=0;a0?[e,n,r]:[n,r]).map((function(t){return t<10?"0".concat(t):String(t)})).join(":")}var X=Object.freeze({__proto__:null,query:p,queryAll:d,addClass:h,removeClass:y,hasClass:v,append:m,remove:function(t){return t.parentNode.removeChild(t)},setStyle:g,setStyles:b,getStyle:w,sublings:O,inverseClass:x,tooltip:k,ArtPlayerError:E,errorHandle:S,srtToVtt:$,vttToBlob:R,assToVtt:T,getExt:D,downloadFile:C,def:q,has:V,proxyPropertys:F,mergeDeep:H,sleep:B,debounce:I,throttle:N,clamp:U,secondToTime:_});function Y(t,e,n){return S("string"===e||t instanceof Element,"".concat(n.join(".")," require 'string' or 'Element' type"))}var Z={container:Y,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:Y,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined"}],contextmenu:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:Y,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:Y,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"},J={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"]}},G=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}}))},Q=function(){function e(n){var r=this;t(this,e),this.art=n,n.option.container instanceof Element?this.$container=n.option.container:(this.$container=p(n.option.container),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='
Player version:
3.2.4
Video url:
Video volume:
Video time:
Video duration:
Video resolution:
x
[x]
xD7
'),this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video"),this.$track=this.query(".art-video track"),this.$subtitle=this.query(".art-subtitle"),this.$danmuku=this.query(".art-danmuku"),this.$bottom=this.query(".art-bottom"),this.$progress=this.query(".art-progress"),this.$controls=this.query(".art-controls"),this.$controlsLeft=this.query(".art-controls-left"),this.$controlsRight=this.query(".art-controls-right"),this.$layer=this.query(".art-layers"),this.$loading=this.query(".art-loading"),this.$notice=this.query(".art-notice"),this.$noticeInner=this.query(".art-notice-inner"),this.$mask=this.query(".art-mask"),this.$state=this.query(".art-state"),this.$setting=this.query(".art-settings"),this.$settingInner=this.query(".art-setting-inner"),this.$settingBody=this.query(".art-setting-body"),this.$info=this.query(".art-info"),this.$infoPanel=this.query(".art-info-panel"),this.$infoClose=this.query(".art-info-close"),this.$pipHeader=this.query(".art-pip-header"),this.$pipTitle=this.query(".art-pip-title"),this.$pipClose=this.query(".art-pip-close"),this.$contextmenu=this.query(".art-contextmenus")}},{key:"initMobile",value:function(){this.$container.innerHTML='
',this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video")}},{key:"destroy",value:function(t){t?this.$container.innerHTML="":h(this.$player,"art-destroy")}}]),e}(),K={"About author":"关于作者","Video info":"视频统计信息",Close:"关闭","Video load failed":"视频加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音",Flip:"视频翻转",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新连接","Hide subtitle":"隐藏字幕","Show subtitle":"显示字幕","Hide danmu":"隐藏弹幕","Show danmu":"显示弹幕","Show setting":"显示设置","Hide setting":"隐藏设置",Screenshot:"截图","Play speed":"播放速度","Aspect ratio":"画面比例",Default:"默认",Normal:"正常",Open:"打开","Switch video":"切换","Switch subtitle":"切换字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"网页全屏","Exit web fullscreen":"退出网页全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏","Local Subtitle":"本地字幕","Local Video":"本地视频","Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},tt={"About author":"關於作者","Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"影片翻轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide subtitle":"隱藏字幕","Show subtitle":"顯示字幕","Hide danmu":"隱藏彈幕","Show danmu":"顯示彈幕","Show setting":"顯示设置","Hide setting":"隱藏设置",Screenshot:"截圖","Play speed":"播放速度","Aspect ratio":"畫面比例",Default:"默認",Normal:"正常",Open:"打開","Switch video":"切換","Switch subtitle":"切換字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"網頁全屏","Exit web fullscreen":"退出網頁全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏","Local Subtitle":"本地字幕","Local Video":"本地視頻","Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"},et=function(){function e(n){t(this,e),this.art=n,this.languages={"zh-cn":K,"zh-tw":tt},this.init()}return n(e,[{key:"init",value:function(){var t=this.art.option.lang.toLowerCase();this.language=this.languages[t]||{}}},{key:"get",value:function(t){return this.language[t]||t}},{key:"update",value:function(t){this.languages=H(this.languages,t),this.init()}}]),e}();var nt=r((function(t){!function(){var e="undefined"!=typeof window&&void 0!==window.document?window.document:{},n=t.exports,r=function(){for(var t,n=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],r=0,i=n.length,o={};rh){var y=h*l/u;g(r,"width","".concat(100*y,"%")),g(r,"height","100%"),g(r,"padding","0 ".concat((f-f*y)/2,"px"))}else{var v=u/h/l;g(r,"width","100%"),g(r,"height","".concat(100*v,"%")),g(r,"padding","".concat((p-p*v)/2,"px 0"))}}i.dataset.aspectRatio=n,a.show("".concat(o.get("Aspect ratio"),": ").concat("default"===n?o.get("Default"):n)),t.emit("aspectRatioChange",n)}else e.aspectRatio&&(g(r,"width",null),g(r,"height",null),g(r,"padding",null),delete i.dataset.aspectRatio,t.emit("aspectRatioRemove"))}}),q(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;q(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}}}),q(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)}}))}}),q(e,"screenshot",{value:function(){var r=e.getScreenshotDataURL();r&&(C(r,"".concat(n.title||"artplayer","_").concat(_(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("fullscreenChange",nt.isFullscreen)},c=function(){r.show(n.get("Does not support fullscreen"))};e.fullscreenIsEnabled&&(nt.on("change",a),nt.on("error",c),i.push((function(){nt.off("change",a),nt.off("error",c)}))),q(e,"fullscreen",{get:function(){return nt.isFullscreen},set:function(n){e.fullscreenIsEnabled?n?(e.fullscreenWeb&&(e.fullscreenWeb=!1),nt.request(o).then((function(){h(o,"art-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenEnabled")}))):(e.fullscreenWeb&&(e.fullscreenWeb=!1),nt.exit().then((function(){y(o,"art-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenExit")}))):c()}}),q(e,"fullscreenToggle",{set:function(t){t&&(e.fullscreen=!e.fullscreen)}}),q(e,"fullscreenIsEnabled",{get:function(){return nt.isEnabled}})}(n,this),function(t,e){var n=t.template.$player;q(e,"fullscreenWeb",{get:function(){return v(n,"art-web-fullscreen")},set:function(r){r?(e.fullscreen&&(e.fullscreen=!1),h(n,"art-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWebEnabled")):(e.fullscreen&&(e.fullscreen=!1),y(n,"art-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWebExit"))}}),q(e,"fullscreenWebToggle",{set:function(t){t&&(e.fullscreenWeb=!e.fullscreenWeb)}})}(n,this),rt(n,this),function(t,e){var n=t.template.$video;q(e,"loaded",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1)/n.duration:0}}),q(e,"loadedTime",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1):0}})}(n,this),function(t,e){q(e,"played",{get:function(){return t.template.$video.currentTime/t.template.$video.duration}})}(n,this),function(t,e){var n=t.template.$video;q(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;q(e,"autoSize",{get:function(){return v(r,"art-auto-size")},set:function(n){if(n){var a=o.videoWidth,c=o.videoHeight,s=r.getBoundingClientRect(),u=s.width,l=s.height,f=a/c,p=u/l;if(h(r,"art-auto-size"),p>f){g(i,"width","".concat(l*f/u*100,"%")),g(i,"height","100%")}else{var d=u/f/l*100;g(i,"width","100%"),g(i,"height","".concat(d,"%"))}t.emit("autoSizeChange",{width:e.width,height:e.height})}else y(r,"art-auto-size"),g(i,"width",null),g(i,"height",null),t.emit("autoSizeRemove")}})}(n,this),function(t,e){q(e,"rect",{get:function(){return t.template.$player.getBoundingClientRect()}}),["bottom","height","left","right","top","width"].forEach((function(t){q(e,t,{get:function(){return e.rect[t]}})})),q(e,"x",{get:function(){return e.left+window.pageXOffset}}),q(e,"y",{get:function(){return e.top+window.pageYOffset}})}(n,this),function(t,e){q(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),F(n,this)};var ot=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=c(t)););return t},at=r((function(t){function e(n,r,i){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=e=Reflect.get:t.exports=e=function(t,e,n){var r=ot(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}},e(n,r,i||n)}t.exports=e})),ct=function(){function e(n){t(this,e),this.id=0,this.art=n,this.add=this.add.bind(this),this.name=this.constructor.name.toLowerCase()}return n(e,[{key:"toggle",value:function(){this.show=!this.show}},{key:"add",value:function(t,e){var n=this,r="function"==typeof t?t(this.art):t;if(!this.$parent||r.disable)return{};this.id+=1;var i=r.name||"".concat(this.name).concat(this.id);S(!V(this,i),"Cannot add a component that already has the same name: ".concat(i));var o=document.createElement("div");o.classList.value="art-".concat(this.name," art-").concat(this.name,"-").concat(i),r.html&&m(o,r.html),r.style&&b(o,r.style),r.tooltip&&k(o,r.tooltip);var a=Array.from(this.$parent.children);o.dataset.index=r.index||this.id;var c=a.find((function(t){return Number(t.dataset.index)>=Number(o.dataset.index)}));return c?c.insertAdjacentElement("beforebegin",o):m(this.$parent,o),r.click&&this.art.events.proxy(o,"click",(function(t){t.preventDefault(),r.click.call(n.art,n,t)})),r.mounted&&r.mounted(o,this,this.art),e&&e(o,this,this.art),q(this,i,{value:{get $ref(){return o},set show(t){g(o,"display",t?"block":"none")}}}),this.art.emit("".concat(this.name,":add"),r),this[i]}},{key:"show",get:function(){return v(this.art.template.$player,"art-".concat(this.name,"-show"))},set:function(t){S(!1===t||!0===t,"The show attribute expects a boolean value");var e=this.art.template.$player,n="art-".concat(this.name,"-show");t?h(e,n):y(e,n),this.art.emit("".concat(this.name,":toggle"),t)}}]),e}();var st=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};function ut(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function lt(t){return function(e){return function(t){for(var e=1;e
'),mounted:function(t){var n=!1,i=p(".art-progress-loaded",t),c=p(".art-progress-played",t),s=p(".art-progress-highlight",t),u=p(".art-progress-indicator",t),l=p(".art-progress-tip",t);function f(t,e){"loaded"===t&&g(i,"width","".concat(100*e,"%")),"played"===t&&(g(c,"width","".concat(100*e,"%")),g(u,"left","calc(".concat(100*e,"% - ").concat(w(u,"width")/2,"px)")))}r.forEach((function(t){var e=U(t.time,0,a.duration)/a.duration*100;m(s,''))})),f("loaded",a.loaded),e.on("video:progress",(function(){f("loaded",a.loaded)})),e.on("video:timeupdate",(function(){f("played",a.played)})),e.on("video:ended",(function(){f("played",1)})),o(t,"mousemove",(function(n){g(l,"display","block"),n.composedPath().indexOf(s)>-1?function(n){var r=gt(e,n).width,i=n.target.dataset.text;l.innerHTML=i;var o=l.clientWidth;r<=o/2?g(l,"left",0):r>t.clientWidth-o/2?g(l,"left","".concat(t.clientWidth-o,"px")):g(l,"left","".concat(r-o/2,"px"))}(n):function(n){var r=gt(e,n),i=r.width,o=r.time;l.innerHTML=o;var a=l.clientWidth;i<=a/2?g(l,"left",0):i>t.clientWidth-a/2?g(l,"left","".concat(t.clientWidth-a,"px")):g(l,"left","".concat(i-a/2,"px"))}(n)})),o(t,"mouseout",(function(){g(l,"display","none")})),o(t,"click",(function(t){if(t.target!==u){var n=gt(e,t),r=n.second;f("played",n.percentage),a.seek=r}})),o(u,"mousedown",(function(){n=!0})),o(document,"mousemove",(function(t){if(n){var r=gt(e,t),i=r.second,o=r.percentage;h(u,"art-show-indicator"),f("played",o),a.seek=i}})),o(document,"mouseup",(function(){n&&(n=!1,y(u,"art-show-indicator"))}))}})}}function wt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ot(t){return function(e){return function(t){for(var e=1;e'),l=m(u,'
');function f(t){var e=u.getBoundingClientRect(),n=e.left,r=e.width,i=l.getBoundingClientRect().width;return U(t.pageX-n-i/2,0,r-i/2)/(r-i)}function p(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.7;if(i.muted||0===t)g(c,"display","none"),g(s,"display","flex"),g(l,"left","0");else{var e=((w(u,"width")||60)-w(l,"width"))*t;g(c,"display","flex"),g(s,"display","none"),g(l,"left","".concat(e,"px"))}}k(c,o.get("Mute")),g(s,"display","none"),p(i.volume),e.on("video:volumechange",(function(){p(i.volume)})),n(c,"click",(function(){i.muted=!0})),n(s,"click",(function(){i.muted=!1})),n(u,"click",(function(t){i.muted=!1,i.volume=f(t)})),n(l,"mousedown",(function(){a=!0})),n(document,"mousemove",(function(t){a&&(i.muted=!1,i.volume=f(t))})),n(document,"mouseup",(function(){a&&(a=!1)}))}})}}function 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;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 Tt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Dt(t){return function(e){return function(t){for(var e=1;e'.concat(s.name,"")),l=n.map((function(t,e){return'
').concat(t.name,"
")})).join(""),f=m(t,'
'.concat(l,"
"));o(t,(function(){f.style.left="-".concat(w(f,"width")/2-t.clientWidth/2,"px")})),i(f,"click",(function(t){var e=Number(t.target.dataset.index),r=n[e],i=r.url,o=r.name;i&&o&&c!==e&&(a.switchQuality(i,o),u.innerHTML=o,c=e)}))}})}}var At=function(e){function r(e){var n;t(this,r),n=a(this,c(r).call(this,e));var i=e.option;return e.on("ready",(function(){n.add(bt({name:"progress",disable:i.isLive,position:"top",index:10})),n.add(Rt({name:"thumbnails",disable:!i.thumbnails.url||i.isLive,position:"top",index:20})),n.add(vt({name:"playAndPause",disable:!1,position:"left",index:10})),n.add(Pt({name:"volume",disable:!1,position:"left",index:20})),n.add(kt({name:"time",disable:i.isLive,position:"left",index:30})),n.add(Lt({name:"quality",disable:0===i.quality.length,position:"right",index:10})),n.add(Dt({name:"screenshot",disable:!i.screenshot,position:"right",index:20})),n.add(Ot({name:"subtitle",disable:!i.subtitle.url,position:"right",index:30})),n.add(St({name:"setting",disable:!i.setting,position:"right",index:40})),n.add(ht({name:"pip",disable:!i.pip,position:"right",index:50})),n.add(pt({name:"fullscreenWeb",disable:!i.fullscreenWeb,position:"right",index:60})),n.add(lt({name:"fullscreen",disable:!i.fullscreen,position:"right",index:70})),i.controls.forEach((function(t){n.add(t)}))})),n}return u(r,e),n(r,[{key:"add",value:function(t,e){var n="function"==typeof t?t(this.art):t;S(n.position,"Controls option.position can not be empty");var i=this.art.template,o=i.$progress,a=i.$controlsLeft,s=i.$controlsRight;switch(n.position){case"top":this.$parent=o;break;case"left":this.$parent=a;break;case"right":this.$parent=s}var u=at(c(r.prototype),"add",this).call(this,n,e);return n.disable||"top"===n.position||u.$ref.firstElementChild&&"I"===u.$ref.firstElementChild.tagName||h(u.$ref,"art-control-onlyText"),u}}]),r}(ct);function Mt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function zt(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e0.50.75').concat(n.get("Normal"),'1.251.52.0'),click:function(t,e){var n=e.target.dataset.rate;n&&(r.playbackRate=Number(n),t.show=!1)},mounted:function(t){e.on("playbackRateChange",(function(e){var n=d("span",t).find((function(t){return Number(t.dataset.rate)===e}));n&&x(n,"art-current")}))}})}}function qt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Wt(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e').concat(n.get("Default"),'4:316:9'),click:function(t,e){var n=e.target.dataset.ratio;n&&(r.aspectRatio=n,t.show=!1)},mounted:function(t){e.on("aspectRatioChange",(function(e){var n=d("span",t).find((function(t){return t.dataset.ratio===e}));n&&x(n,"art-current")}))}})}}function Vt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ft(t){return function(e){return function(t){for(var e=1;eArtPlayer 3.2.4'})}function It(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 Nt(t){return function(e){return function(t){for(var e=1;ec+a&&(h=a-d),n+p>l+o&&(y=o-p),g(u,"left","".concat(h,"px")),g(u,"top","".concat(y,"px"))})),l(s,"click",(function(t){t.composedPath().includes(u)||(r.show=!1)})),e.on("blur",(function(){r.show=!1}))})),r}return u(n,e),n}(ct),_t=function(e){function n(e){var r;t(this,n),r=a(this,c(n).call(this,e));var i=e.template,o=i.$infoPanel,s=i.$infoClose,u=i.$video;(0,e.events.proxy)(s,"click",(function(){r.show=!1}));var l=null,f=d("[data-video]",o);return e.on("destroy",(function(){clearTimeout(l)})),e.on("info:toggle",(function(t){clearTimeout(l),t&&function t(){f.forEach((function(t){var e=u[t.dataset.video];t.innerHTML="number"==typeof e?e.toFixed(2):e})),l=setTimeout((function(){t()}),1e3)}()})),r}return u(n,e),n}(ct),Xt=function(e){function r(e){var n;t(this,r),n=a(this,c(r).call(this,e));var i=e.events.proxy,s=e.option.subtitle;return b(e.template.$subtitle,s.style),i(n.textTrack,"cuechange",n.update.bind(o(n))),s.url&&n.init(s.url),n}return u(r,e),n(r,[{key:"update",value:function(){var t=this.art.template.$subtitle;t.innerHTML="",this.activeCue&&(t.innerHTML=this.activeCue.text.split(/\r?\n/).map((function(t){return"

".concat(t,"

")})).join(""),this.art.emit("subtitle:update",this.activeCue.text))}},{key:"switch",value:function(t,e){var n=this,r=this.art,i=r.i18n,o=r.notice;return this.init(t).then((function(t){return e&&o.show("".concat(i.get("Switch subtitle"),": ").concat(e)),n.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(n){switch(e.art.emit("subtitle:load",t),D(t)){case"srt":return R($(n));case"ass":return R(T(n));case"vtt":return R(n);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),e.art.emit("subtitle:err",t),t}))}},{key:"url",get:function(){return this.art.template.$track.src}},{key:"textTrack",get:function(){return this.art.template.$video.textTracks[0]}},{key:"activeCue",get:function(){return this.textTrack.activeCues[0]}}]),r}(ct);var Yt=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,"art-hover"),t.emit("hoverenter")}),(function(){y(n,"art-hover"),t.emit("hoverleave")}))}(n,r),function(t,e){var n=t.template,r=n.$player,i=n.$video,o=t.player,a=I((function(){h(r,"art-hide-cursor"),y(r,"art-hover"),t.controls.show=!1}),3e3);t.on("hoverleave",(function(){o.playing&&a()})),e.proxy(r,"mousemove",(function(e){a.clearTimeout(),y(r,"art-hide-cursor"),t.controls.show=!0,!t.player.pip&&o.playing&&e.target===i&&a(),t.emit("mousemove")}))}(n,r),function(t,e){var n=t.option,r=t.player,i=t.template.$player,o=document.createElement("object");o.setAttribute("aria-hidden","true"),o.setAttribute("tabindex",-1),o.type="text/html",o.data="about:blank";var a=r.width,c=r.height,s=N((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}(),Zt=function(){function e(n){var r=this;t(this,e),this.keys={};var i=n.option,o=n.player,a=n.events.proxy;i.hotkey&&n.on("ready",(function(){r.add(27,(function(){o.fullscreenWeb&&(o.fullscreenWeb=!1)})),r.add(32,(function(){o.toggle=!0})),r.add(37,(function(){o.seek=o.currentTime-5})),r.add(38,(function(){o.volume+=.1})),r.add(39,(function(){o.seek=o.currentTime+5})),r.add(40,(function(){o.volume-=.1})),a(window,"keydown",(function(t){if(n.isFocus){var e=document.activeElement.tagName.toUpperCase(),i=document.activeElement.getAttribute("contenteditable");if("INPUT"!==e&&"TEXTAREA"!==e&&""!==i&&"true"!==i){var o=r.keys[t.keyCode];o&&(t.preventDefault(),o.forEach((function(t){return t()})),n.emit("hotkey",t))}}}))}))}return n(e,[{key:"add",value:function(t,e){this.keys[t]?this.keys[t].push(e):this.keys[t]=[e]}}]),e}(),Jt=function(e){function n(e){var r;return t(this,n),(r=a(this,c(n).call(this,e))).$parent=e.template.$layer,e.on("ready",(function(){e.option.layers.forEach((function(t){r.add(t)}))})),r}return u(n,e),n}(ct),Gt=function(e){function n(e){var r;return t(this,n),r=a(this,c(n).call(this,e)),m(e.template.$loading,e.icons.loading),r}return u(n,e),n}(ct),Qt=function(){function e(n){t(this,e),this.art=n,this.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;a.innerHTML=t instanceof Error?t.message.trim():t,clearTimeout(this.timer),n&&(this.timer=setTimeout((function(){e.hide()}),r)),h(o,"art-notice-show"),this.art.emit("notice:toggle",!0)}},{key:"hide",value:function(){var t=this.art.template,e=t.$player;t.$noticeInner.innerHTML="",y(e,"art-notice-show"),this.art.emit("notice:toggle",!0)}}]),e}(),Kt=function(e){function n(e){var r;return t(this,n),r=a(this,c(n).call(this,e)),m(e.template.$state,e.icons.state),r}return u(n,e),n}(ct),te=function e(n){var r=this;t(this,e);var i=Object.assign({loading:'',state:'',play:'',pause:'',volume:'',volumeClose:'',subtitle:'',screenshot:'\t',setting:'',fullscreen:'\t\t\t\t',fullscreenWeb:'\t',pip:'',prev:'',next:''},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 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;return function(t){for(var e=1;e'.concat(n.get("Flip"),'
"),click:function(t,e){var n=e.target.dataset.value;n&&(r.flip=n)},mounted:function(t){e.on("flipChange",(function(e){var n=d("button",t).find((function(t){return t.dataset.value===e}));n&&x(n.parentElement,"current")}))}})}}function re(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 ie(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e'.concat(n.get("Aspect ratio"),'
'),click:function(t,e){var n=e.target.dataset.value;n&&(r.aspectRatio=n)},mounted:function(t){e.on("aspectRatioChange",(function(e){var n=d("button",t).find((function(t){return t.dataset.value===e}));n&&x(n.parentElement,"current")}))}})}}function oe(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 ae(t){return function(e){var n=e.i18n,r=e.player,i=e.events.proxy;return function(t){for(var e=1;e'.concat(n.get("Play speed"),': 1.0x
'),mounted:function(t){var n=p(".art-setting-range input",t),o=p(".art-subtitle-value",t);i(n,"change",(function(){var t=n.value;o.innerText=t,r.playbackRate=Number(t)})),e.on("playbackRateChange",(function(t){n.value!==t&&(n.value=t,o.innerText=t)}))}})}}var ce=function(e){function n(e){var r;t(this,n),r=a(this,c(n).call(this,e));var i=e.option,o=e.template,s=o.$setting,u=o.$settingBody,l=e.events.proxy;return r.$parent=u,i.setting&&(e.on("ready",(function(){l(s,"click",(function(t){t.target===s&&(r.show=!1)})),r.add(ne({disable:!i.flip,name:"flip"})),r.add(ie({disable:!i.aspectRatio,name:"aspectRatio"})),r.add(ae({disable:!i.playbackRate,name:"playbackRate"}))})),e.on("blur",(function(){r.show=!1}))),r}return u(n,e),n}(ct),se=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(),st({},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 ue(t){var e=t.i18n,n=t.subtitle,r=t.events.proxy;return{title:"Subtitle",name:"subtitleOffset",index:20,html:'
'.concat(e.get("Subtitle offset time"),': 0s
'),mounted:function(e){var i=p(".art-setting-range input",e),o=p(".art-subtitle-value",e);r(i,"change",(function(){var e=i.value;o.innerText=e,t.plugins.subtitleOffset.offset(Number(e))})),t.on("subtitle:switch",(function(){i.value=0,o.innerText=0})),t.on("subtitleOffset",(function(t){n.update(),i.value!==t&&(i.value=t,o.innerText=t)}))}}}function le(t){var e=t.constructor.utils.clamp,n=t.setting,r=t.notice,i=t.template,o=t.i18n,a=t.player;n.add(ue);var c=[];return t.on("subtitle:switch",(function(){c=[]})),{name:"subtitleOffset",offset:function(n){if(i.$track&&i.$track.track){var s=Array.from(i.$track.track.cues),u=e(n,-5,5);s.forEach((function(t,n){c[n]||(c[n]={startTime:t.startTime,endTime:t.endTime}),t.startTime=e(c[n].startTime+u,0,a.duration),t.endTime=e(c[n].endTime+u,0,a.duration)})),r.show("".concat(o.get("Subtitle offset time"),": ").concat(n,"s")),t.emit("subtitleOffset",n)}else r.show("".concat(o.get("No subtitles found"))),t.emit("subtitleOffset",0)}}}function fe(t){var e=t.events.proxy,n=t.template,r=t.player,i=t.option,o=t.setting,a=t.i18n;function c(e){if(e){var o=n.$video.canPlayType(e.type);if("maybe"===o||"probably"===o){var a=URL.createObjectURL(e);i.title=e.name,r.switchUrl(a,e.name),t.emit("localVideo",e)}else S(!1,"Playback of this file format is not supported")}}function s(t){var n=m(t,'');g(t,"position","relative"),b(n,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(n,"change",(function(){c(n.files[0])}))}return e(n.$player,"dragover",(function(t){t.preventDefault()})),e(n.$player,"drop",(function(t){t.preventDefault(),c(t.dataTransfer.files[0])})),t.on("ready",(function(){o.add({title:"Local Video",name:"localVideo",index:30,html:'
'.concat(a.get("Local Video"),'
').concat(a.get("Open"),'
'),mounted:function(e){var n=p(".art-upload-btn",e),r=p(".art-upload-value",e);t.on("localVideo",(function(t){r.textContent=t.name,r.title=t.name})),s(n)}})})),{name:"localVideo",attach:s}}function pe(t){var e=t.events.proxy,n=t.subtitle,r=t.setting,i=t.i18n;function o(r){var i=m(r,'');g(r,"position","relative"),b(i,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(i,"change",(function(){!function(r){if(r){var i=D(r.name);if(["ass","vtt","srt"].includes(i)){var o=new FileReader;e(o,"load",(function(e){var o=e.target.result;switch(i){case"srt":var a=R($(o));n.switch(a,r.name);break;case"ass":var c=R(T(o));n.switch(c,r.name);break;case"vtt":var s=R(o);n.switch(s,r.name)}t.emit("localSubtitle",r)})),o.readAsText(r)}else S(!1,"Only supports subtitle files in .ass, .vtt and .srt format")}}(i.files[0])}))}return t.on("ready",(function(){r.add({title:"Local Subtitle",name:"localSubtitle",index:40,html:'
'.concat(i.get("Local Subtitle"),'
').concat(i.get("Open"),'
'),mounted:function(e){var n=p(".art-upload-btn",e),r=p(".art-upload-value",e);t.on("localSubtitle",(function(t){r.textContent=t.name,r.title=t.name})),o(n)}})})),{name:"localSubtitle",attach:o}}function de(t){var e=t.layers,n=t.player,r=t.option.theme;return e.add({name:"miniProgressBar",style:{display:"none",position:"absolute",left:0,right:0,bottom:0,height:"2px",background:r},mounted:function(e){t.on("control:toggle",(function(t){e.style.display=t?"none":"block"})),t.on("destroy",(function(){e.style.display="none"})),t.on("video:timeupdate",(function(){e.style.width="".concat(100*n.played,"%")}))}}),{name:"miniProgressBar"}}function he(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 ye(t){var e=t.events,n=t.player,r=t.template,i=I((function(){var e=r.$player.getBoundingClientRect();e.top+e.height<=0&&!n.pip?(n.pip=!0,t.emit("autoPip",!0)):n.pip&&(n.pip=!1,t.emit("autoPip",!1))}),300);return e.proxy(window,"scroll",i),{name:"autoPip"}}var ve=function(){function e(n){var r=this;t(this,e),this.art=n,this.id=0;var i=n.option;i.subtitle.url&&i.subtitleOffset&&this.add(le),!i.isLive&&i.miniProgressBar&&this.add(de),i.localVideo&&this.add(fe),i.localSubtitle&&this.add(pe),i.networkMonitor&&this.add(he),i.autoPip&&this.add(ye),n.option.plugins.forEach((function(t){r.add(t)}))}return n(e,[{key:"add",value:function(t){this.id+=1;var e=t.call(this,this.art),n="";return S(!V(this,n=e&&e.name?e.name:t.name?t.name:"plugin".concat(this.id)),"Cannot add a plugin that already has the same name: ".concat(n)),Object.defineProperty(this,n,{value:e}),this.art.emit("plugin:add",t),this}}]),e}(),me=function e(n){t(this,e);var r=n.option,i=n.events.proxy,o=n.template.$video;J.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=U(r.volume,0,1)),r.poster&&(o.poster=r.poster),r.autoplay&&(o.autoplay=r.autoplay),o.controls=!0;var a=r.type||D(r.url),c=r.customType[a];a&&c?(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))},ge=0,be=function(e){function r(e){var n;return t(this,r),(n=a(this,c(r).call(this))).option=l(H(r.option,e),Z),n.isFocus=!1,n.isDestroy=!1,n.whitelist=new G(o(n)),n.template=new Q(o(n)),n.events=new Yt(o(n)),n.whitelist.state?(n.storage=new se(o(n)),n.icons=new te(o(n)),n.i18n=new et(o(n)),n.notice=new Qt(o(n)),n.player=new it(o(n)),n.layers=new Jt(o(n)),n.controls=new At(o(n)),n.contextmenu=new Ut(o(n)),n.subtitle=new Xt(o(n)),n.info=new _t(o(n)),n.loading=new Gt(o(n)),n.hotkey=new Zt(o(n)),n.mask=new Kt(o(n)),n.setting=new ce(o(n)),n.plugins=new ve(o(n))):n.mobile=new me(o(n)),ge+=1,n.id=ge,r.instances.push(o(n)),n}return u(r,e),n(r,[{key:"destroy",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.events.destroy(),this.template.destroy(t),r.instances.splice(r.instances.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}],[{key:"version",get:function(){return"3.2.4"}},{key:"env",get:function(){return'"production"'}},{key:"config",get:function(){return J}},{key:"utils",get:function(){return X}},{key:"scheme",get:function(){return Z}},{key:"Emitter",get:function(){return f}},{key:"validator",get:function(){return l}},{key:"kindOf",get:function(){return l.kindOf}},{key:"option",get:function(){return{container:"#artplayer",url:"",poster:"",title:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,loop:!1,flip:!1,playbackRate:!1,aspectRatio:!1,screenshot:!1,setting:!1,hotkey:!0,pip:!1,mutex:!0,fullscreen:!1,fullscreenWeb:!1,subtitleOffset:!1,miniProgressBar:!1,localVideo:!1,localSubtitle:!1,autoPip:!1,networkMonitor:!1,layers:[],contextmenu:[],quality:[],controls:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,width:160,height:90,column:10},subtitle:{url:"",style:{}},moreVideoAttr:{controls:!1,preload:"metadata"},icons:{},customType:{},lang:navigator.language.toLowerCase()}}}]),r}(f);return Object.defineProperty(be,"instances",{value:[]}),console.log("%c ArtPlayer %c 3.2.4 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),be})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Artplayer=e()}(this,(function(){"use strict";var t=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function e(t,e){for(var n=0;n1?n-1:0),i=1;i1&&void 0!==arguments[1]?arguments[1]:document).querySelector(t)}function d(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(e.querySelectorAll(t))}function h(t,e){return t.classList.add(e)}function y(t,e){return t.classList.remove(e)}function v(t,e){return t.classList.contains(e)}function m(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function g(t,e,n){return t.style[e]=n,t}function b(t,e){return Object.keys(e).forEach((function(n){g(t,n,e[n])})),t}function w(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=window.getComputedStyle(t,null).getPropertyValue(e);return n?parseFloat(r):r}function O(t){return Array.from(t.parentElement.children).filter((function(e){return e!==t}))}function j(t,e){O(t).forEach((function(t){return y(t,e)})),h(t,e)}function x(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"up";t.setAttribute("aria-label",e),t.setAttribute("data-balloon-pos",n)}var k=function(t){return-1!==Function.toString.call(t).indexOf("[native code]")},P=r((function(t){function e(n,r,i){return!function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}()?t.exports=e=function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&s(i,n.prototype),i}:t.exports=e=Reflect.construct,e.apply(null,arguments)}t.exports=e})),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 P(t,arguments,c(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),s(e,t)},e(n)}t.exports=e}))(Error));function 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 L=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e1?e-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(e){return setTimeout(e,t)}))}function I(t,e,n){var r;function i(){for(var i=arguments.length,o=new Array(i),a=0;a0?[e,n,r]:[n,r]).map((function(t){return t<10?"0".concat(t):String(t)})).join(":")}var X=Object.freeze({__proto__:null,query:p,queryAll:d,addClass:h,removeClass:y,hasClass:v,append:m,remove:function(t){return t.parentNode.removeChild(t)},setStyle:g,setStyles:b,getStyle:w,sublings:O,inverseClass:j,tooltip:x,ArtPlayerError:E,errorHandle:S,srtToVtt:$,vttToBlob:R,assToVtt:T,getExt:D,downloadFile:C,def:q,has:V,proxyPropertys:F,mergeDeep:H,sleep:B,debounce:I,throttle:N,clamp:U,secondToTime:_});function Y(t,e,n){return S("string"===e||t instanceof Element,"".concat(n.join(".")," require 'string' or 'Element' type"))}var Z={container:Y,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:Y,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined"}],contextmenu:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:Y,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:Y,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"},J={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"]}},G=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}}))},Q=function(){function e(n){var r=this;t(this,e),this.art=n,n.option.container instanceof Element?this.$container=n.option.container:(this.$container=p(n.option.container),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='
Player version:
3.2.4
Video url:
Video volume:
Video time:
Video duration:
Video resolution:
x
[x]
xD7
'),this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video"),this.$track=this.query(".art-video track"),this.$subtitle=this.query(".art-subtitle"),this.$danmuku=this.query(".art-danmuku"),this.$bottom=this.query(".art-bottom"),this.$progress=this.query(".art-progress"),this.$controls=this.query(".art-controls"),this.$controlsLeft=this.query(".art-controls-left"),this.$controlsRight=this.query(".art-controls-right"),this.$layer=this.query(".art-layers"),this.$loading=this.query(".art-loading"),this.$notice=this.query(".art-notice"),this.$noticeInner=this.query(".art-notice-inner"),this.$mask=this.query(".art-mask"),this.$state=this.query(".art-state"),this.$setting=this.query(".art-settings"),this.$settingInner=this.query(".art-setting-inner"),this.$settingBody=this.query(".art-setting-body"),this.$info=this.query(".art-info"),this.$infoPanel=this.query(".art-info-panel"),this.$infoClose=this.query(".art-info-close"),this.$pipHeader=this.query(".art-pip-header"),this.$pipTitle=this.query(".art-pip-title"),this.$pipClose=this.query(".art-pip-close"),this.$contextmenu=this.query(".art-contextmenus")}},{key:"initMobile",value:function(){this.$container.innerHTML='
',this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video")}},{key:"destroy",value:function(t){t?this.$container.innerHTML="":h(this.$player,"art-destroy")}}]),e}(),K={"About author":"关于作者","Video info":"视频统计信息",Close:"关闭","Video load failed":"视频加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音",Flip:"视频翻转",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新连接","Hide subtitle":"隐藏字幕","Show subtitle":"显示字幕","Hide danmu":"隐藏弹幕","Show danmu":"显示弹幕","Show setting":"显示设置","Hide setting":"隐藏设置",Screenshot:"截图","Play speed":"播放速度","Aspect ratio":"画面比例",Default:"默认",Normal:"正常",Open:"打开","Switch video":"切换","Switch subtitle":"切换字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"网页全屏","Exit web fullscreen":"退出网页全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏","Local Subtitle":"本地字幕","Local Video":"本地视频","Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},tt={"About author":"關於作者","Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"影片翻轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide subtitle":"隱藏字幕","Show subtitle":"顯示字幕","Hide danmu":"隱藏彈幕","Show danmu":"顯示彈幕","Show setting":"顯示设置","Hide setting":"隱藏设置",Screenshot:"截圖","Play speed":"播放速度","Aspect ratio":"畫面比例",Default:"默認",Normal:"正常",Open:"打開","Switch video":"切換","Switch subtitle":"切換字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"網頁全屏","Exit web fullscreen":"退出網頁全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏","Local Subtitle":"本地字幕","Local Video":"本地視頻","Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"},et=function(){function e(n){t(this,e),this.art=n,this.languages={"zh-cn":K,"zh-tw":tt},this.init()}return n(e,[{key:"init",value:function(){var t=this.art.option.lang.toLowerCase();this.language=this.languages[t]||{}}},{key:"get",value:function(t){return this.language[t]||t}},{key:"update",value:function(t){this.languages=H(this.languages,t),this.init()}}]),e}();var nt=r((function(t){!function(){var e="undefined"!=typeof window&&void 0!==window.document?window.document:{},n=t.exports,r=function(){for(var t,n=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],r=0,i=n.length,o={};rh){var y=h*l/u;g(r,"width","".concat(100*y,"%")),g(r,"height","100%"),g(r,"padding","0 ".concat((f-f*y)/2,"px"))}else{var v=u/h/l;g(r,"width","100%"),g(r,"height","".concat(100*v,"%")),g(r,"padding","".concat((p-p*v)/2,"px 0"))}}i.dataset.aspectRatio=n,a.show("".concat(o.get("Aspect ratio"),": ").concat("default"===n?o.get("Default"):n)),t.emit("aspectRatioChange",n)}else e.aspectRatio&&(g(r,"width",null),g(r,"height",null),g(r,"padding",null),delete i.dataset.aspectRatio,t.emit("aspectRatioRemove"))}}),q(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;q(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}}}),q(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)}}))}}),q(e,"screenshot",{value:function(){var r=e.getScreenshotDataURL();r&&(C(r,"".concat(n.title||"artplayer","_").concat(_(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("fullscreenChange",nt.isFullscreen)},c=function(){r.show(n.get("Does not support fullscreen"))};e.fullscreenIsEnabled&&(nt.on("change",a),nt.on("error",c),i.push((function(){nt.off("change",a),nt.off("error",c)}))),q(e,"fullscreen",{get:function(){return nt.isFullscreen},set:function(n){e.fullscreenIsEnabled?n?(e.fullscreenWeb&&(e.fullscreenWeb=!1),nt.request(o).then((function(){h(o,"art-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenEnabled")}))):(e.fullscreenWeb&&(e.fullscreenWeb=!1),nt.exit().then((function(){y(o,"art-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenExit")}))):c()}}),q(e,"fullscreenToggle",{set:function(t){t&&(e.fullscreen=!e.fullscreen)}}),q(e,"fullscreenIsEnabled",{get:function(){return nt.isEnabled}})}(n,this),function(t,e){var n=t.template.$player;q(e,"fullscreenWeb",{get:function(){return v(n,"art-web-fullscreen")},set:function(r){r?(e.fullscreen&&(e.fullscreen=!1),h(n,"art-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWebEnabled")):(e.fullscreen&&(e.fullscreen=!1),y(n,"art-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWebExit"))}}),q(e,"fullscreenWebToggle",{set:function(t){t&&(e.fullscreenWeb=!e.fullscreenWeb)}})}(n,this),rt(n,this),function(t,e){var n=t.template.$video;q(e,"loaded",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1)/n.duration:0}}),q(e,"loadedTime",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1):0}})}(n,this),function(t,e){q(e,"played",{get:function(){return t.template.$video.currentTime/t.template.$video.duration}})}(n,this),function(t,e){var n=t.template.$video;q(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;q(e,"autoSize",{get:function(){return v(r,"art-auto-size")},set:function(n){if(n){var a=o.videoWidth,c=o.videoHeight,s=r.getBoundingClientRect(),u=s.width,l=s.height,f=a/c,p=u/l;if(h(r,"art-auto-size"),p>f){g(i,"width","".concat(l*f/u*100,"%")),g(i,"height","100%")}else{var d=u/f/l*100;g(i,"width","100%"),g(i,"height","".concat(d,"%"))}t.emit("autoSizeChange",{width:e.width,height:e.height})}else y(r,"art-auto-size"),g(i,"width",null),g(i,"height",null),t.emit("autoSizeRemove")}})}(n,this),function(t,e){q(e,"rect",{get:function(){return t.template.$player.getBoundingClientRect()}}),["bottom","height","left","right","top","width"].forEach((function(t){q(e,t,{get:function(){return e.rect[t]}})})),q(e,"x",{get:function(){return e.left+window.pageXOffset}}),q(e,"y",{get:function(){return e.top+window.pageYOffset}})}(n,this),function(t,e){q(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),F(n,this)};var ot=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=c(t)););return t},at=r((function(t){function e(n,r,i){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=e=Reflect.get:t.exports=e=function(t,e,n){var r=ot(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}},e(n,r,i||n)}t.exports=e})),ct=function(){function e(n){t(this,e),this.id=0,this.art=n,this.add=this.add.bind(this),this.name=this.constructor.name.toLowerCase()}return n(e,[{key:"toggle",value:function(){this.show=!this.show}},{key:"add",value:function(t,e){var n=this,r="function"==typeof t?t(this.art):t;if(!this.$parent||r.disable)return{};this.id+=1;var i=r.name||"".concat(this.name).concat(this.id);S(!V(this,i),"Cannot add a component that already has the same name: ".concat(i));var o=document.createElement("div");o.classList.value="art-".concat(this.name," art-").concat(this.name,"-").concat(i),r.html&&m(o,r.html),r.style&&b(o,r.style),r.tooltip&&x(o,r.tooltip);var a=Array.from(this.$parent.children);o.dataset.index=r.index||this.id;var c=a.find((function(t){return Number(t.dataset.index)>=Number(o.dataset.index)}));return c?c.insertAdjacentElement("beforebegin",o):m(this.$parent,o),r.click&&this.art.events.proxy(o,"click",(function(t){t.preventDefault(),r.click.call(n.art,n,t)})),r.mounted&&r.mounted(o,this,this.art),e&&e(o,this,this.art),q(this,i,{value:{get $ref(){return o},set show(t){g(o,"display",t?"block":"none")}}}),this.art.emit("".concat(this.name,":add"),r),this[i]}},{key:"show",get:function(){return v(this.art.template.$player,"art-".concat(this.name,"-show"))},set:function(t){S(!1===t||!0===t,"The show attribute expects a boolean value");var e=this.art.template.$player,n="art-".concat(this.name,"-show");t?h(e,n):y(e,n),this.art.emit("".concat(this.name,":toggle"),t)}}]),e}();var st=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};function ut(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function lt(t){return function(e){return function(t){for(var e=1;e
'),mounted:function(t){var n=!1,i=p(".art-progress-loaded",t),c=p(".art-progress-played",t),s=p(".art-progress-highlight",t),u=p(".art-progress-indicator",t),l=p(".art-progress-tip",t);function f(t,e){"loaded"===t&&g(i,"width","".concat(100*e,"%")),"played"===t&&(g(c,"width","".concat(100*e,"%")),g(u,"left","calc(".concat(100*e,"% - ").concat(w(u,"width")/2,"px)")))}r.forEach((function(t){var e=U(t.time,0,a.duration)/a.duration*100;m(s,''))})),f("loaded",a.loaded),e.on("video:progress",(function(){f("loaded",a.loaded)})),e.on("video:timeupdate",(function(){f("played",a.played)})),e.on("video:ended",(function(){f("played",1)})),o(t,"mousemove",(function(n){g(l,"display","block"),n.composedPath().indexOf(s)>-1?function(n){var r=gt(e,n).width,i=n.target.dataset.text;l.innerHTML=i;var o=l.clientWidth;r<=o/2?g(l,"left",0):r>t.clientWidth-o/2?g(l,"left","".concat(t.clientWidth-o,"px")):g(l,"left","".concat(r-o/2,"px"))}(n):function(n){var r=gt(e,n),i=r.width,o=r.time;l.innerHTML=o;var a=l.clientWidth;i<=a/2?g(l,"left",0):i>t.clientWidth-a/2?g(l,"left","".concat(t.clientWidth-a,"px")):g(l,"left","".concat(i-a/2,"px"))}(n)})),o(t,"mouseout",(function(){g(l,"display","none")})),o(t,"click",(function(t){if(t.target!==u){var n=gt(e,t),r=n.second;f("played",n.percentage),a.seek=r}})),o(u,"mousedown",(function(){n=!0})),o(document,"mousemove",(function(t){if(n){var r=gt(e,t),i=r.second,o=r.percentage;h(u,"art-show-indicator"),f("played",o),a.seek=i}})),o(document,"mouseup",(function(){n&&(n=!1,y(u,"art-show-indicator"))}))}})}}function wt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ot(t){return function(e){return function(t){for(var e=1;e'),l=m(u,'
');function f(t){var e=u.getBoundingClientRect(),n=e.left,r=e.width,i=l.getBoundingClientRect().width;return U(t.pageX-n-i/2,0,r-i/2)/(r-i)}function p(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.7;if(i.muted||0===t)g(c,"display","none"),g(s,"display","flex"),g(l,"left","0");else{var e=((w(u,"width")||60)-w(l,"width"))*t;g(c,"display","flex"),g(s,"display","none"),g(l,"left","".concat(e,"px"))}}x(c,o.get("Mute")),g(s,"display","none"),p(i.volume),e.on("video:volumechange",(function(){p(i.volume)})),n(c,"click",(function(){i.muted=!0})),n(s,"click",(function(){i.muted=!1})),n(u,"click",(function(t){i.muted=!1,i.volume=f(t)})),n(l,"mousedown",(function(){a=!0})),n(document,"mousemove",(function(t){a&&(i.muted=!1,i.volume=f(t))})),n(document,"mouseup",(function(){a&&(a=!1)}))}})}}function 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;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 Tt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Dt(t){return function(e){return function(t){for(var e=1;e'.concat(s.name,"")),l=n.map((function(t,e){return'
').concat(t.name,"
")})).join(""),f=m(t,'
'.concat(l,"
"));o(t,(function(){f.style.left="-".concat(w(f,"width")/2-t.clientWidth/2,"px")})),i(f,"click",(function(t){var e=Number(t.target.dataset.index),r=n[e],i=r.url,o=r.name;i&&o&&c!==e&&(a.switchQuality(i,o),u.innerHTML=o,c=e)}))}})}}var At=function(e){function r(e){var n;t(this,r),n=a(this,c(r).call(this,e));var i=e.option;return e.on("ready",(function(){n.add(bt({name:"progress",disable:i.isLive,position:"top",index:10})),n.add(Rt({name:"thumbnails",disable:!i.thumbnails.url||i.isLive,position:"top",index:20})),n.add(vt({name:"playAndPause",disable:!1,position:"left",index:10})),n.add(Pt({name:"volume",disable:!1,position:"left",index:20})),n.add(xt({name:"time",disable:i.isLive,position:"left",index:30})),n.add(Lt({name:"quality",disable:0===i.quality.length,position:"right",index:10})),n.add(Dt({name:"screenshot",disable:!i.screenshot,position:"right",index:20})),n.add(Ot({name:"subtitle",disable:!i.subtitle.url,position:"right",index:30})),n.add(St({name:"setting",disable:!i.setting,position:"right",index:40})),n.add(ht({name:"pip",disable:!i.pip,position:"right",index:50})),n.add(pt({name:"fullscreenWeb",disable:!i.fullscreenWeb,position:"right",index:60})),n.add(lt({name:"fullscreen",disable:!i.fullscreen,position:"right",index:70})),i.controls.forEach((function(t){n.add(t)}))})),n}return u(r,e),n(r,[{key:"add",value:function(t,e){var n="function"==typeof t?t(this.art):t;S(n.position,"Controls option.position can not be empty");var i=this.art.template,o=i.$progress,a=i.$controlsLeft,s=i.$controlsRight;switch(n.position){case"top":this.$parent=o;break;case"left":this.$parent=a;break;case"right":this.$parent=s}var u=at(c(r.prototype),"add",this).call(this,n,e);return n.disable||"top"===n.position||u.$ref.firstElementChild&&"I"===u.$ref.firstElementChild.tagName||h(u.$ref,"art-control-onlyText"),u}}]),r}(ct);function Mt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function zt(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e0.50.75').concat(n.get("Normal"),'1.251.52.0'),click:function(t,e){var n=e.target.dataset.rate;n&&(r.playbackRate=Number(n),t.show=!1)},mounted:function(t){e.on("playbackRateChange",(function(e){var n=d("span",t).find((function(t){return Number(t.dataset.rate)===e}));n&&j(n,"art-current")}))}})}}function qt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Wt(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e').concat(n.get("Default"),'4:316:9'),click:function(t,e){var n=e.target.dataset.ratio;n&&(r.aspectRatio=n,t.show=!1)},mounted:function(t){e.on("aspectRatioChange",(function(e){var n=d("span",t).find((function(t){return t.dataset.ratio===e}));n&&j(n,"art-current")}))}})}}function Vt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ft(t){return function(e){return function(t){for(var e=1;eArtPlayer 3.2.4'})}function It(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 Nt(t){return function(e){return function(t){for(var e=1;ec+a&&(h=a-d),n+p>l+o&&(y=o-p),g(u,"left","".concat(h,"px")),g(u,"top","".concat(y,"px"))})),l(s,"click",(function(t){t.composedPath().includes(u)||(r.show=!1)})),e.on("blur",(function(){r.show=!1}))})),r}return u(n,e),n}(ct),_t=function(e){function n(e){var r;t(this,n),r=a(this,c(n).call(this,e));var i=e.template,o=i.$infoPanel,s=i.$infoClose,u=i.$video;(0,e.events.proxy)(s,"click",(function(){r.show=!1}));var l=null,f=d("[data-video]",o);return e.on("destroy",(function(){clearTimeout(l)})),e.on("info:toggle",(function(t){clearTimeout(l),t&&function t(){f.forEach((function(t){var e=u[t.dataset.video];t.innerHTML="number"==typeof e?e.toFixed(2):e})),l=setTimeout((function(){t()}),1e3)}()})),r}return u(n,e),n}(ct),Xt=function(e){function r(e){var n;t(this,r),n=a(this,c(r).call(this,e));var i=e.events.proxy,s=e.option.subtitle;return b(e.template.$subtitle,s.style),i(n.textTrack,"cuechange",n.update.bind(o(n))),s.url&&n.init(s.url),n}return u(r,e),n(r,[{key:"update",value:function(){var t=this.art.template.$subtitle;t.innerHTML="",this.activeCue&&(t.innerHTML=this.activeCue.text.split(/\r?\n/).map((function(t){return"

".concat(t,"

")})).join(""),this.art.emit("subtitle:update",this.activeCue.text))}},{key:"switch",value:function(t,e){var n=this,r=this.art,i=r.i18n,o=r.notice;return this.init(t).then((function(t){return e&&o.show("".concat(i.get("Switch subtitle"),": ").concat(e)),n.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(n){switch(e.art.emit("subtitle:load",t),D(t)){case"srt":return R($(n));case"ass":return R(T(n));case"vtt":return R(n);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),e.art.emit("subtitle:err",t),t}))}},{key:"url",get:function(){return this.art.template.$track.src}},{key:"textTrack",get:function(){return this.art.template.$video.textTracks[0]}},{key:"activeCue",get:function(){return this.textTrack.activeCues[0]}}]),r}(ct);var Yt=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,"art-hover"),t.emit("hoverenter")}),(function(){y(n,"art-hover"),t.emit("hoverleave")}))}(n,r),function(t,e){var n=t.template,r=n.$player,i=n.$video,o=t.player,a=I((function(){h(r,"art-hide-cursor"),y(r,"art-hover"),t.controls.show=!1}),3e3);t.on("hoverleave",(function(){o.playing&&a()})),e.proxy(r,"mousemove",(function(e){a.clearTimeout(),y(r,"art-hide-cursor"),t.controls.show=!0,!t.player.pip&&o.playing&&e.target===i&&a(),t.emit("mousemove")}))}(n,r),function(t,e){var n=t.option,r=t.player,i=t.template.$player,o=document.createElement("object");o.setAttribute("aria-hidden","true"),o.setAttribute("tabindex",-1),o.type="text/html",o.data="about:blank";var a=r.width,c=r.height,s=N((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}(),Zt=function(){function e(n){var r=this;t(this,e),this.keys={};var i=n.option,o=n.player,a=n.events.proxy;i.hotkey&&n.on("ready",(function(){r.add(27,(function(){o.fullscreenWeb&&(o.fullscreenWeb=!1)})),r.add(32,(function(){o.toggle=!0})),r.add(37,(function(){o.seek=o.currentTime-5})),r.add(38,(function(){o.volume+=.1})),r.add(39,(function(){o.seek=o.currentTime+5})),r.add(40,(function(){o.volume-=.1})),a(window,"keydown",(function(t){if(n.isFocus){var e=document.activeElement.tagName.toUpperCase(),i=document.activeElement.getAttribute("contenteditable");if("INPUT"!==e&&"TEXTAREA"!==e&&""!==i&&"true"!==i){var o=r.keys[t.keyCode];o&&(t.preventDefault(),o.forEach((function(t){return t()})),n.emit("hotkey",t))}}}))}))}return n(e,[{key:"add",value:function(t,e){this.keys[t]?this.keys[t].push(e):this.keys[t]=[e]}}]),e}(),Jt=function(e){function n(e){var r;return t(this,n),(r=a(this,c(n).call(this,e))).$parent=e.template.$layer,e.on("ready",(function(){e.option.layers.forEach((function(t){r.add(t)}))})),r}return u(n,e),n}(ct),Gt=function(e){function n(e){var r;return t(this,n),r=a(this,c(n).call(this,e)),m(e.template.$loading,e.icons.loading),r}return u(n,e),n}(ct),Qt=function(){function e(n){t(this,e),this.art=n,this.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;a.innerHTML=t instanceof Error?t.message.trim():t,clearTimeout(this.timer),n&&(this.timer=setTimeout((function(){e.hide()}),r)),h(o,"art-notice-show"),this.art.emit("notice:toggle",!0)}},{key:"hide",value:function(){var t=this.art.template,e=t.$player;t.$noticeInner.innerHTML="",y(e,"art-notice-show"),this.art.emit("notice:toggle",!0)}}]),e}(),Kt=function(e){function n(e){var r;return t(this,n),r=a(this,c(n).call(this,e)),m(e.template.$state,e.icons.state),r}return u(n,e),n}(ct),te=function e(n){var r=this;t(this,e);var i=Object.assign({loading:'',state:'',play:'',pause:'',volume:'',volumeClose:'',subtitle:'',screenshot:'\t',setting:'',fullscreen:'\t\t\t\t',fullscreenWeb:'\t',pip:'',prev:'',next:''},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 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;return function(t){for(var e=1;e'.concat(n.get("Flip"),'
"),click:function(t,e){var n=e.target.dataset.value;n&&(r.flip=n)},mounted:function(t){e.on("flipChange",(function(e){var n=d("button",t).find((function(t){return t.dataset.value===e}));n&&j(n.parentElement,"current")}))}})}}function re(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 ie(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e'.concat(n.get("Aspect ratio"),'
'),click:function(t,e){var n=e.target.dataset.value;n&&(r.aspectRatio=n)},mounted:function(t){e.on("aspectRatioChange",(function(e){var n=d("button",t).find((function(t){return t.dataset.value===e}));n&&j(n.parentElement,"current")}))}})}}function oe(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 ae(t){return function(e){var n=e.i18n,r=e.player,i=e.events.proxy;return function(t){for(var e=1;e'.concat(n.get("Play speed"),': 1.0x
'),mounted:function(t){var n=p(".art-setting-range input",t),o=p(".art-subtitle-value",t);i(n,"change",(function(){var t=n.value;o.innerText=t,r.playbackRate=Number(t)})),e.on("playbackRateChange",(function(t){n.value!==t&&(n.value=t,o.innerText=t)}))}})}}var ce=function(e){function n(e){var r;t(this,n),r=a(this,c(n).call(this,e));var i=e.option,o=e.template,s=o.$setting,u=o.$settingBody,l=e.events.proxy;return r.$parent=u,i.setting&&(e.on("ready",(function(){l(s,"click",(function(t){t.target===s&&(r.show=!1)})),r.add(ne({disable:!i.flip,name:"flip"})),r.add(ie({disable:!i.aspectRatio,name:"aspectRatio"})),r.add(ae({disable:!i.playbackRate,name:"playbackRate"}))})),e.on("blur",(function(){r.show=!1}))),r}return u(n,e),n}(ct),se=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(),st({},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 ue(t){var e=t.i18n,n=t.subtitle,r=t.events.proxy;return{title:"Subtitle",name:"subtitleOffset",index:20,html:'
'.concat(e.get("Subtitle offset time"),': 0s
'),mounted:function(e){var i=p(".art-setting-range input",e),o=p(".art-subtitle-value",e);r(i,"change",(function(){var e=i.value;o.innerText=e,t.plugins.subtitleOffset.offset(Number(e))})),t.on("subtitle:switch",(function(){i.value=0,o.innerText=0})),t.on("subtitleOffset",(function(t){n.update(),i.value!==t&&(i.value=t,o.innerText=t)}))}}}function le(t){var e=t.constructor.utils.clamp,n=t.setting,r=t.notice,i=t.template,o=t.i18n,a=t.player;n.add(ue);var c=[];return t.on("subtitle:switch",(function(){c=[]})),{name:"subtitleOffset",offset:function(n){if(i.$track&&i.$track.track){var s=Array.from(i.$track.track.cues),u=e(n,-5,5);s.forEach((function(t,n){c[n]||(c[n]={startTime:t.startTime,endTime:t.endTime}),t.startTime=e(c[n].startTime+u,0,a.duration),t.endTime=e(c[n].endTime+u,0,a.duration)})),r.show("".concat(o.get("Subtitle offset time"),": ").concat(n,"s")),t.emit("subtitleOffset",n)}else r.show("".concat(o.get("No subtitles found"))),t.emit("subtitleOffset",0)}}}function fe(t){var e=t.events.proxy,n=t.template,r=t.player,i=t.option,o=t.setting,a=t.i18n;function c(e){if(e){var o=n.$video.canPlayType(e.type);if("maybe"===o||"probably"===o){var a=URL.createObjectURL(e);i.title=e.name,r.switchUrl(a,e.name),t.emit("localVideo",e)}else S(!1,"Playback of this file format is not supported")}}function s(t){var n=m(t,'');g(t,"position","relative"),b(n,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(n,"change",(function(){c(n.files[0])}))}return e(n.$player,"dragover",(function(t){t.preventDefault()})),e(n.$player,"drop",(function(t){t.preventDefault(),c(t.dataTransfer.files[0])})),t.on("ready",(function(){o.add({title:"Local Video",name:"localVideo",index:30,html:'
'.concat(a.get("Local Video"),'
').concat(a.get("Open"),'
'),mounted:function(e){var n=p(".art-upload-btn",e),r=p(".art-upload-value",e);t.on("localVideo",(function(t){r.textContent=t.name,r.title=t.name})),s(n)}})})),{name:"localVideo",attach:s}}function pe(t){var e=t.events.proxy,n=t.subtitle,r=t.setting,i=t.i18n;function o(r){var i=m(r,'');g(r,"position","relative"),b(i,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(i,"change",(function(){!function(r){if(r){var i=D(r.name);if(["ass","vtt","srt"].includes(i)){var o=new FileReader;e(o,"load",(function(e){var o=e.target.result;switch(i){case"srt":var a=R($(o));n.switch(a,r.name);break;case"ass":var c=R(T(o));n.switch(c,r.name);break;case"vtt":var s=R(o);n.switch(s,r.name)}t.emit("localSubtitle",r)})),o.readAsText(r)}else S(!1,"Only supports subtitle files in .ass, .vtt and .srt format")}}(i.files[0])}))}return t.on("ready",(function(){r.add({title:"Local Subtitle",name:"localSubtitle",index:40,html:'
'.concat(i.get("Local Subtitle"),'
').concat(i.get("Open"),'
'),mounted:function(e){var n=p(".art-upload-btn",e),r=p(".art-upload-value",e);t.on("localSubtitle",(function(t){r.textContent=t.name,r.title=t.name})),o(n)}})})),{name:"localSubtitle",attach:o}}function de(t){var e=t.layers,n=t.player,r=t.option.theme;return e.add({name:"miniProgressBar",style:{display:"none",position:"absolute",left:0,right:0,bottom:0,height:"2px",background:r},mounted:function(e){t.on("control:toggle",(function(t){e.style.display=t?"none":"block"})),t.on("destroy",(function(){e.style.display="none"})),t.on("video:timeupdate",(function(){e.style.width="".concat(100*n.played,"%")}))}}),{name:"miniProgressBar"}}function he(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 ye(t){var e=t.events,n=t.player,r=t.template,i=I((function(){var e=r.$player.getBoundingClientRect();e.top+e.height<=0&&!n.pip?(n.pip=!0,t.emit("autoPip",!0)):n.pip&&(n.pip=!1,t.emit("autoPip",!1))}),300);return e.proxy(window,"scroll",i),{name:"autoPip"}}var ve=function(){function e(n){var r=this;t(this,e),this.art=n,this.id=0;var i=n.option;i.subtitle.url&&i.subtitleOffset&&this.add(le),!i.isLive&&i.miniProgressBar&&this.add(de),i.localVideo&&this.add(fe),i.localSubtitle&&this.add(pe),i.networkMonitor&&this.add(he),i.autoPip&&this.add(ye),n.option.plugins.forEach((function(t){r.add(t)}))}return n(e,[{key:"add",value:function(t){this.id+=1;var e=t.call(this,this.art),n="";return S(!V(this,n=e&&e.name?e.name:t.name?t.name:"plugin".concat(this.id)),"Cannot add a plugin that already has the same name: ".concat(n)),Object.defineProperty(this,n,{value:e}),this.art.emit("plugin:add",t),this}}]),e}(),me=function e(n){t(this,e);var r=n.option,i=n.events.proxy,o=n.template.$video;J.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=U(r.volume,0,1)),r.poster&&(o.poster=r.poster),r.autoplay&&(o.autoplay=r.autoplay),o.controls=!0;var a=r.type||D(r.url),c=r.customType[a];a&&c?(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))},ge=0,be=function(e){function r(e){var n;return t(this,r),(n=a(this,c(r).call(this))).option=l(H(r.option,e),Z),n.isFocus=!1,n.isDestroy=!1,n.whitelist=new G(o(n)),n.template=new Q(o(n)),n.events=new Yt(o(n)),n.whitelist.state?(n.storage=new se(o(n)),n.icons=new te(o(n)),n.i18n=new et(o(n)),n.notice=new Qt(o(n)),n.player=new it(o(n)),n.layers=new Jt(o(n)),n.controls=new At(o(n)),n.contextmenu=new Ut(o(n)),n.subtitle=new Xt(o(n)),n.info=new _t(o(n)),n.loading=new Gt(o(n)),n.hotkey=new Zt(o(n)),n.mask=new Kt(o(n)),n.setting=new ce(o(n)),n.plugins=new ve(o(n))):n.mobile=new me(o(n)),ge+=1,n.id=ge,r.instances.push(o(n)),n}return u(r,e),n(r,[{key:"destroy",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.events.destroy(),this.template.destroy(t),r.instances.splice(r.instances.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}],[{key:"version",get:function(){return"3.2.4"}},{key:"env",get:function(){return'"production"'}},{key:"config",get:function(){return J}},{key:"utils",get:function(){return X}},{key:"scheme",get:function(){return Z}},{key:"Emitter",get:function(){return f}},{key:"validator",get:function(){return l}},{key:"kindOf",get:function(){return l.kindOf}},{key:"option",get:function(){return{container:"#artplayer",url:"",poster:"",title:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,loop:!1,flip:!1,playbackRate:!1,aspectRatio:!1,screenshot:!1,setting:!1,hotkey:!0,pip:!1,mutex:!0,fullscreen:!1,fullscreenWeb:!1,subtitleOffset:!1,miniProgressBar:!1,localVideo:!1,localSubtitle:!1,autoPip:!1,networkMonitor:!1,layers:[],contextmenu:[],quality:[],controls:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,width:160,height:90,column:10},subtitle:{url:"",style:{}},moreVideoAttr:{controls:!1,preload:"metadata"},icons:{},customType:{},lang:navigator.language.toLowerCase()}}}]),r}(f);return Object.defineProperty(be,"instances",{value:[]}),console.log("%c ArtPlayer %c 3.2.4 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),be})); diff --git a/packages/artplayer/dist/artplayer.css b/packages/artplayer/dist/artplayer.css index fc25c3e21..b21abf5ef 100644 --- a/packages/artplayer/dist/artplayer.css +++ b/packages/artplayer/dist/artplayer.css @@ -1,4 +1,4 @@ -.art-video-player{display:-webkit-box;display:-ms-flexbox;display:flex;position:relative;margin:0 auto;z-index:10;width:100%;height:100%;outline:0;zoom:1;font-family:Roboto,Arial,Helvetica,sans-serif;color:#eee;text-align:left;direction:ltr;font-size:14px;line-height:1.3;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-touch-action:manipulation;touch-action:manipulation;-ms-high-contrast-adjust:none}.art-video-player *{margin:0;padding:0;-webkit-box-sizing:border-box;box-sizing:border-box}.art-video-player ::-webkit-scrollbar{width:5px}.art-video-player ::-webkit-scrollbar-thumb{background-color:#666}.art-video-player ::-webkit-scrollbar-thumb:hover{background-color:#ccc}.art-video-player .art-icon{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;line-height:1.5}.art-video-player .art-icon svg{fill:#fff}.art-video-player>object{display:block;position:absolute;top:0;left:0;height:100%;width:100%;overflow:hidden;pointer-events:none;z-index:-1}@supports ((-webkit-backdrop-filter:initial) or (backdrop-filter:initial)){.art-video-player .art-backdrop-filter{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:rgba(0,0,0,.7)!important}} +.art-video-player{display:-webkit-box;display:-ms-flexbox;display:flex;position:relative;margin:0 auto;z-index:10;width:100%;height:100%;outline:0;zoom:1;font-family:Roboto,Arial,Helvetica,sans-serif;color:#eee;text-align:left;direction:ltr;font-size:14px;line-height:1.3;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-touch-action:manipulation;touch-action:manipulation;-ms-high-contrast-adjust:none}.art-video-player *{margin:0;padding:0;-webkit-box-sizing:border-box;box-sizing:border-box}.art-video-player ::-webkit-scrollbar{width:5px}.art-video-player ::-webkit-scrollbar-thumb{background-color:#666}.art-video-player ::-webkit-scrollbar-thumb:hover{background-color:#ccc}.art-video-player .art-icon{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;line-height:1.5}.art-video-player .art-icon svg{fill:#fff}.art-video-player img{max-width:100%;vertical-align:top}.art-video-player>object{display:block;position:absolute;top:0;left:0;height:100%;width:100%;overflow:hidden;pointer-events:none;z-index:-1}@supports ((-webkit-backdrop-filter:initial) or (backdrop-filter:initial)){.art-video-player .art-backdrop-filter{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:rgba(0,0,0,.7)!important}} .art-video-player .art-video{position:absolute;z-index:10;left:0;top:0;right:0;bottom:0;width:100%;height:100%;background-color:#000;cursor:pointer} .art-video-player .art-subtitle{display:none;position:absolute;z-index:20;bottom:40px;width:100%;padding:0 20px;text-align:center;color:#fff;font-size:20px;pointer-events:none;text-shadow:.5px .5px .5px rgba(0,0,0,.5)}.art-video-player .art-subtitle p{margin:5px 0}.art-video-player.art-subtitle-show .art-subtitle{display:block} .art-video-player .art-danmuku{position:absolute;z-index:30;left:0;top:0;right:0;bottom:0;width:100%;height:100%;overflow:hidden;pointer-events:none} diff --git a/packages/artplayer/dist/artplayer.js b/packages/artplayer/dist/artplayer.js index 9286d28c2..3205a6e6c 100644 --- a/packages/artplayer/dist/artplayer.js +++ b/packages/artplayer/dist/artplayer.js @@ -5,4 +5,4 @@ * Released under the MIT License. */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Artplayer=e()}(this,(function(){"use strict";var t=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function e(t,e){for(var n=0;n1?n-1:0),i=1;i1&&void 0!==arguments[1]?arguments[1]:document).querySelector(t)}function d(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(e.querySelectorAll(t))}function h(t,e){return t.classList.add(e)}function y(t,e){return t.classList.remove(e)}function v(t,e){return t.classList.contains(e)}function m(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function g(t,e,n){return t.style[e]=n,t}function b(t,e){return Object.keys(e).forEach((function(n){g(t,n,e[n])})),t}function w(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=window.getComputedStyle(t,null).getPropertyValue(e);return n?parseFloat(r):r}function O(t){return Array.from(t.parentElement.children).filter((function(e){return e!==t}))}function x(t,e){O(t).forEach((function(t){return y(t,e)})),h(t,e)}function k(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 j=function(t){return-1!==Function.toString.call(t).indexOf("[native code]")},P=r((function(t){function e(n,r,i){return!function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}()?t.exports=e=function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&s(i,n.prototype),i}:t.exports=e=Reflect.construct,e.apply(null,arguments)}t.exports=e})),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||!j(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,e)}function e(){return P(t,arguments,c(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),s(e,t)},e(n)}t.exports=e}))(Error));function 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 L=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e1?e-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(e){return setTimeout(e,t)}))}function I(t,e,n){var r;function i(){for(var i=arguments.length,o=new Array(i),a=0;a0?[e,n,r]:[n,r]).map((function(t){return t<10?"0".concat(t):String(t)})).join(":")}var X=Object.freeze({__proto__:null,query:p,queryAll:d,addClass:h,removeClass:y,hasClass:v,append:m,remove:function(t){return t.parentNode.removeChild(t)},setStyle:g,setStyles:b,getStyle:w,sublings:O,inverseClass:x,tooltip:k,ArtPlayerError:E,errorHandle:S,srtToVtt:$,vttToBlob:R,assToVtt:T,getExt:D,downloadFile:C,def:q,has:V,proxyPropertys:F,mergeDeep:H,sleep:B,debounce:I,throttle:N,clamp:U,secondToTime:_});function Y(t,e,n){return S("string"===e||t instanceof Element,"".concat(n.join(".")," require 'string' or 'Element' type"))}var Z={container:Y,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:Y,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined"}],contextmenu:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:Y,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:Y,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"},J={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"]}},G=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}}))},Q=function(){function e(n){var r=this;t(this,e),this.art=n,n.option.container instanceof Element?this.$container=n.option.container:(this.$container=p(n.option.container),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='
Player version:
3.2.4
Video url:
Video volume:
Video time:
Video duration:
Video resolution:
x
[x]
xD7
'),this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video"),this.$track=this.query(".art-video track"),this.$subtitle=this.query(".art-subtitle"),this.$danmuku=this.query(".art-danmuku"),this.$bottom=this.query(".art-bottom"),this.$progress=this.query(".art-progress"),this.$controls=this.query(".art-controls"),this.$controlsLeft=this.query(".art-controls-left"),this.$controlsRight=this.query(".art-controls-right"),this.$layer=this.query(".art-layers"),this.$loading=this.query(".art-loading"),this.$notice=this.query(".art-notice"),this.$noticeInner=this.query(".art-notice-inner"),this.$mask=this.query(".art-mask"),this.$state=this.query(".art-state"),this.$setting=this.query(".art-settings"),this.$settingInner=this.query(".art-setting-inner"),this.$settingBody=this.query(".art-setting-body"),this.$info=this.query(".art-info"),this.$infoPanel=this.query(".art-info-panel"),this.$infoClose=this.query(".art-info-close"),this.$pipHeader=this.query(".art-pip-header"),this.$pipTitle=this.query(".art-pip-title"),this.$pipClose=this.query(".art-pip-close"),this.$contextmenu=this.query(".art-contextmenus")}},{key:"initMobile",value:function(){this.$container.innerHTML='
',this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video")}},{key:"destroy",value:function(t){t?this.$container.innerHTML="":h(this.$player,"art-destroy")}}]),e}(),K={"About author":"关于作者","Video info":"视频统计信息",Close:"关闭","Video load failed":"视频加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音",Flip:"视频翻转",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新连接","Hide subtitle":"隐藏字幕","Show subtitle":"显示字幕","Hide danmu":"隐藏弹幕","Show danmu":"显示弹幕","Show setting":"显示设置","Hide setting":"隐藏设置",Screenshot:"截图","Play speed":"播放速度","Aspect ratio":"画面比例",Default:"默认",Normal:"正常",Open:"打开","Switch video":"切换","Switch subtitle":"切换字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"网页全屏","Exit web fullscreen":"退出网页全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏","Local Subtitle":"本地字幕","Local Video":"本地视频","Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},tt={"About author":"關於作者","Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"影片翻轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide subtitle":"隱藏字幕","Show subtitle":"顯示字幕","Hide danmu":"隱藏彈幕","Show danmu":"顯示彈幕","Show setting":"顯示设置","Hide setting":"隱藏设置",Screenshot:"截圖","Play speed":"播放速度","Aspect ratio":"畫面比例",Default:"默認",Normal:"正常",Open:"打開","Switch video":"切換","Switch subtitle":"切換字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"網頁全屏","Exit web fullscreen":"退出網頁全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏","Local Subtitle":"本地字幕","Local Video":"本地視頻","Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"},et=function(){function e(n){t(this,e),this.art=n,this.languages={"zh-cn":K,"zh-tw":tt},this.init()}return n(e,[{key:"init",value:function(){var t=this.art.option.lang.toLowerCase();this.language=this.languages[t]||{}}},{key:"get",value:function(t){return this.language[t]||t}},{key:"update",value:function(t){this.languages=H(this.languages,t),this.init()}}]),e}();var nt=r((function(t){!function(){var e="undefined"!=typeof window&&void 0!==window.document?window.document:{},n=t.exports,r=function(){for(var t,n=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],r=0,i=n.length,o={};rh){var y=h*l/u;g(r,"width","".concat(100*y,"%")),g(r,"height","100%"),g(r,"padding","0 ".concat((f-f*y)/2,"px"))}else{var v=u/h/l;g(r,"width","100%"),g(r,"height","".concat(100*v,"%")),g(r,"padding","".concat((p-p*v)/2,"px 0"))}}i.dataset.aspectRatio=n,a.show("".concat(o.get("Aspect ratio"),": ").concat("default"===n?o.get("Default"):n)),t.emit("aspectRatioChange",n)}else e.aspectRatio&&(g(r,"width",null),g(r,"height",null),g(r,"padding",null),delete i.dataset.aspectRatio,t.emit("aspectRatioRemove"))}}),q(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;q(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}}}),q(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)}}))}}),q(e,"screenshot",{value:function(){var r=e.getScreenshotDataURL();r&&(C(r,"".concat(n.title||"artplayer","_").concat(_(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("fullscreenChange",nt.isFullscreen)},c=function(){r.show(n.get("Does not support fullscreen"))};e.fullscreenIsEnabled&&(nt.on("change",a),nt.on("error",c),i.push((function(){nt.off("change",a),nt.off("error",c)}))),q(e,"fullscreen",{get:function(){return nt.isFullscreen},set:function(n){e.fullscreenIsEnabled?n?(e.fullscreenWeb&&(e.fullscreenWeb=!1),nt.request(o).then((function(){h(o,"art-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenEnabled")}))):(e.fullscreenWeb&&(e.fullscreenWeb=!1),nt.exit().then((function(){y(o,"art-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenExit")}))):c()}}),q(e,"fullscreenToggle",{set:function(t){t&&(e.fullscreen=!e.fullscreen)}}),q(e,"fullscreenIsEnabled",{get:function(){return nt.isEnabled}})}(n,this),function(t,e){var n=t.template.$player;q(e,"fullscreenWeb",{get:function(){return v(n,"art-web-fullscreen")},set:function(r){r?(e.fullscreen&&(e.fullscreen=!1),h(n,"art-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWebEnabled")):(e.fullscreen&&(e.fullscreen=!1),y(n,"art-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWebExit"))}}),q(e,"fullscreenWebToggle",{set:function(t){t&&(e.fullscreenWeb=!e.fullscreenWeb)}})}(n,this),rt(n,this),function(t,e){var n=t.template.$video;q(e,"loaded",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1)/n.duration:0}}),q(e,"loadedTime",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1):0}})}(n,this),function(t,e){q(e,"played",{get:function(){return t.template.$video.currentTime/t.template.$video.duration}})}(n,this),function(t,e){var n=t.template.$video;q(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;q(e,"autoSize",{get:function(){return v(r,"art-auto-size")},set:function(n){if(n){var a=o.videoWidth,c=o.videoHeight,s=r.getBoundingClientRect(),u=s.width,l=s.height,f=a/c,p=u/l;if(h(r,"art-auto-size"),p>f){g(i,"width","".concat(l*f/u*100,"%")),g(i,"height","100%")}else{var d=u/f/l*100;g(i,"width","100%"),g(i,"height","".concat(d,"%"))}t.emit("autoSizeChange",{width:e.width,height:e.height})}else y(r,"art-auto-size"),g(i,"width",null),g(i,"height",null),t.emit("autoSizeRemove")}})}(n,this),function(t,e){q(e,"rect",{get:function(){return t.template.$player.getBoundingClientRect()}}),["bottom","height","left","right","top","width"].forEach((function(t){q(e,t,{get:function(){return e.rect[t]}})})),q(e,"x",{get:function(){return e.left+window.pageXOffset}}),q(e,"y",{get:function(){return e.top+window.pageYOffset}})}(n,this),function(t,e){q(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),F(n,this)};var ot=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=c(t)););return t},at=r((function(t){function e(n,r,i){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=e=Reflect.get:t.exports=e=function(t,e,n){var r=ot(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}},e(n,r,i||n)}t.exports=e})),ct=function(){function e(n){t(this,e),this.id=0,this.art=n,this.add=this.add.bind(this),this.name=this.constructor.name.toLowerCase()}return n(e,[{key:"toggle",value:function(){this.show=!this.show}},{key:"add",value:function(t,e){var n=this,r="function"==typeof t?t(this.art):t;if(!this.$parent||r.disable)return{};this.id+=1;var i=r.name||"".concat(this.name).concat(this.id);S(!V(this,i),"Cannot add a component that already has the same name: ".concat(i));var o=document.createElement("div");o.classList.value="art-".concat(this.name," art-").concat(this.name,"-").concat(i),r.html&&m(o,r.html),r.style&&b(o,r.style),r.tooltip&&k(o,r.tooltip);var a=Array.from(this.$parent.children);o.dataset.index=r.index||this.id;var c=a.find((function(t){return Number(t.dataset.index)>=Number(o.dataset.index)}));return c?c.insertAdjacentElement("beforebegin",o):m(this.$parent,o),r.click&&this.art.events.proxy(o,"click",(function(t){t.preventDefault(),r.click.call(n.art,n,t)})),r.mounted&&r.mounted(o,this,this.art),e&&e(o,this,this.art),q(this,i,{value:{get $ref(){return o},set show(t){g(o,"display",t?"block":"none")}}}),this.art.emit("".concat(this.name,":add"),r),this[i]}},{key:"show",get:function(){return v(this.art.template.$player,"art-".concat(this.name,"-show"))},set:function(t){S(!1===t||!0===t,"The show attribute expects a boolean value");var e=this.art.template.$player,n="art-".concat(this.name,"-show");t?h(e,n):y(e,n),this.art.emit("".concat(this.name,":toggle"),t)}}]),e}();var st=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};function ut(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function lt(t){return function(e){return function(t){for(var e=1;e
'),mounted:function(t){var n=!1,i=p(".art-progress-loaded",t),c=p(".art-progress-played",t),s=p(".art-progress-highlight",t),u=p(".art-progress-indicator",t),l=p(".art-progress-tip",t);function f(t,e){"loaded"===t&&g(i,"width","".concat(100*e,"%")),"played"===t&&(g(c,"width","".concat(100*e,"%")),g(u,"left","calc(".concat(100*e,"% - ").concat(w(u,"width")/2,"px)")))}r.forEach((function(t){var e=U(t.time,0,a.duration)/a.duration*100;m(s,''))})),f("loaded",a.loaded),e.on("video:progress",(function(){f("loaded",a.loaded)})),e.on("video:timeupdate",(function(){f("played",a.played)})),e.on("video:ended",(function(){f("played",1)})),o(t,"mousemove",(function(n){g(l,"display","block"),n.composedPath().indexOf(s)>-1?function(n){var r=gt(e,n).width,i=n.target.dataset.text;l.innerHTML=i;var o=l.clientWidth;r<=o/2?g(l,"left",0):r>t.clientWidth-o/2?g(l,"left","".concat(t.clientWidth-o,"px")):g(l,"left","".concat(r-o/2,"px"))}(n):function(n){var r=gt(e,n),i=r.width,o=r.time;l.innerHTML=o;var a=l.clientWidth;i<=a/2?g(l,"left",0):i>t.clientWidth-a/2?g(l,"left","".concat(t.clientWidth-a,"px")):g(l,"left","".concat(i-a/2,"px"))}(n)})),o(t,"mouseout",(function(){g(l,"display","none")})),o(t,"click",(function(t){if(t.target!==u){var n=gt(e,t),r=n.second;f("played",n.percentage),a.seek=r}})),o(u,"mousedown",(function(){n=!0})),o(document,"mousemove",(function(t){if(n){var r=gt(e,t),i=r.second,o=r.percentage;h(u,"art-show-indicator"),f("played",o),a.seek=i}})),o(document,"mouseup",(function(){n&&(n=!1,y(u,"art-show-indicator"))}))}})}}function wt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ot(t){return function(e){return function(t){for(var e=1;e'),l=m(u,'
');function f(t){var e=u.getBoundingClientRect(),n=e.left,r=e.width,i=l.getBoundingClientRect().width;return U(t.pageX-n-i/2,0,r-i/2)/(r-i)}function p(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.7;if(i.muted||0===t)g(c,"display","none"),g(s,"display","flex"),g(l,"left","0");else{var e=((w(u,"width")||60)-w(l,"width"))*t;g(c,"display","flex"),g(s,"display","none"),g(l,"left","".concat(e,"px"))}}k(c,o.get("Mute")),g(s,"display","none"),p(i.volume),e.on("video:volumechange",(function(){p(i.volume)})),n(c,"click",(function(){i.muted=!0})),n(s,"click",(function(){i.muted=!1})),n(u,"click",(function(t){i.muted=!1,i.volume=f(t)})),n(l,"mousedown",(function(){a=!0})),n(document,"mousemove",(function(t){a&&(i.muted=!1,i.volume=f(t))})),n(document,"mouseup",(function(){a&&(a=!1)}))}})}}function 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;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 Tt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Dt(t){return function(e){return function(t){for(var e=1;e'.concat(s.name,"")),l=n.map((function(t,e){return'
').concat(t.name,"
")})).join(""),f=m(t,'
'.concat(l,"
"));o(t,(function(){f.style.left="-".concat(w(f,"width")/2-t.clientWidth/2,"px")})),i(f,"click",(function(t){var e=Number(t.target.dataset.index),r=n[e],i=r.url,o=r.name;i&&o&&c!==e&&(a.switchQuality(i,o),u.innerHTML=o,c=e)}))}})}}var At=function(e){function r(e){var n;t(this,r),n=a(this,c(r).call(this,e));var i=e.option;return e.on("ready",(function(){n.add(bt({name:"progress",disable:i.isLive,position:"top",index:10})),n.add(Rt({name:"thumbnails",disable:!i.thumbnails.url||i.isLive,position:"top",index:20})),n.add(vt({name:"playAndPause",disable:!1,position:"left",index:10})),n.add(Pt({name:"volume",disable:!1,position:"left",index:20})),n.add(kt({name:"time",disable:i.isLive,position:"left",index:30})),n.add(Lt({name:"quality",disable:0===i.quality.length,position:"right",index:10})),n.add(Dt({name:"screenshot",disable:!i.screenshot,position:"right",index:20})),n.add(Ot({name:"subtitle",disable:!i.subtitle.url,position:"right",index:30})),n.add(St({name:"setting",disable:!i.setting,position:"right",index:40})),n.add(ht({name:"pip",disable:!i.pip,position:"right",index:50})),n.add(pt({name:"fullscreenWeb",disable:!i.fullscreenWeb,position:"right",index:60})),n.add(lt({name:"fullscreen",disable:!i.fullscreen,position:"right",index:70})),i.controls.forEach((function(t){n.add(t)}))})),n}return u(r,e),n(r,[{key:"add",value:function(t,e){var n="function"==typeof t?t(this.art):t;S(n.position,"Controls option.position can not be empty");var i=this.art.template,o=i.$progress,a=i.$controlsLeft,s=i.$controlsRight;switch(n.position){case"top":this.$parent=o;break;case"left":this.$parent=a;break;case"right":this.$parent=s}var u=at(c(r.prototype),"add",this).call(this,n,e);return n.disable||"top"===n.position||u.$ref.firstElementChild&&"I"===u.$ref.firstElementChild.tagName||h(u.$ref,"art-control-onlyText"),u}}]),r}(ct);function Mt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function zt(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e0.50.75').concat(n.get("Normal"),'1.251.52.0'),click:function(t,e){var n=e.target.dataset.rate;n&&(r.playbackRate=Number(n),t.show=!1)},mounted:function(t){e.on("playbackRateChange",(function(e){var n=d("span",t).find((function(t){return Number(t.dataset.rate)===e}));n&&x(n,"art-current")}))}})}}function qt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Wt(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e').concat(n.get("Default"),'4:316:9'),click:function(t,e){var n=e.target.dataset.ratio;n&&(r.aspectRatio=n,t.show=!1)},mounted:function(t){e.on("aspectRatioChange",(function(e){var n=d("span",t).find((function(t){return t.dataset.ratio===e}));n&&x(n,"art-current")}))}})}}function Vt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ft(t){return function(e){return function(t){for(var e=1;eArtPlayer 3.2.4'})}function It(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 Nt(t){return function(e){return function(t){for(var e=1;ec+a&&(h=a-d),n+p>l+o&&(y=o-p),g(u,"left","".concat(h,"px")),g(u,"top","".concat(y,"px"))})),l(s,"click",(function(t){t.composedPath().includes(u)||(r.show=!1)})),e.on("blur",(function(){r.show=!1}))})),r}return u(n,e),n}(ct),_t=function(e){function n(e){var r;t(this,n),r=a(this,c(n).call(this,e));var i=e.template,o=i.$infoPanel,s=i.$infoClose,u=i.$video;(0,e.events.proxy)(s,"click",(function(){r.show=!1}));var l=null,f=d("[data-video]",o);return e.on("destroy",(function(){clearTimeout(l)})),e.on("info:toggle",(function(t){clearTimeout(l),t&&function t(){f.forEach((function(t){var e=u[t.dataset.video];t.innerHTML="number"==typeof e?e.toFixed(2):e})),l=setTimeout((function(){t()}),1e3)}()})),r}return u(n,e),n}(ct),Xt=function(e){function r(e){var n;t(this,r),n=a(this,c(r).call(this,e));var i=e.events.proxy,s=e.option.subtitle;return b(e.template.$subtitle,s.style),i(n.textTrack,"cuechange",n.update.bind(o(n))),s.url&&n.init(s.url),n}return u(r,e),n(r,[{key:"update",value:function(){var t=this.art.template.$subtitle;t.innerHTML="",this.activeCue&&(t.innerHTML=this.activeCue.text.split(/\r?\n/).map((function(t){return"

".concat(t,"

")})).join(""),this.art.emit("subtitle:update",this.activeCue.text))}},{key:"switch",value:function(t,e){var n=this,r=this.art,i=r.i18n,o=r.notice;return this.init(t).then((function(t){return e&&o.show("".concat(i.get("Switch subtitle"),": ").concat(e)),n.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(n){switch(e.art.emit("subtitle:load",t),D(t)){case"srt":return R($(n));case"ass":return R(T(n));case"vtt":return R(n);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),e.art.emit("subtitle:err",t),t}))}},{key:"url",get:function(){return this.art.template.$track.src}},{key:"textTrack",get:function(){return this.art.template.$video.textTracks[0]}},{key:"activeCue",get:function(){return this.textTrack.activeCues[0]}}]),r}(ct);var Yt=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,"art-hover"),t.emit("hoverenter")}),(function(){y(n,"art-hover"),t.emit("hoverleave")}))}(n,r),function(t,e){var n=t.template,r=n.$player,i=n.$video,o=t.player,a=I((function(){h(r,"art-hide-cursor"),y(r,"art-hover"),t.controls.show=!1}),3e3);t.on("hoverleave",(function(){o.playing&&a()})),e.proxy(r,"mousemove",(function(e){a.clearTimeout(),y(r,"art-hide-cursor"),t.controls.show=!0,!t.player.pip&&o.playing&&e.target===i&&a(),t.emit("mousemove")}))}(n,r),function(t,e){var n=t.option,r=t.player,i=t.template.$player,o=document.createElement("object");o.setAttribute("aria-hidden","true"),o.setAttribute("tabindex",-1),o.type="text/html",o.data="about:blank";var a=r.width,c=r.height,s=N((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}(),Zt=function(){function e(n){var r=this;t(this,e),this.keys={};var i=n.option,o=n.player,a=n.events.proxy;i.hotkey&&n.on("ready",(function(){r.add(27,(function(){o.fullscreenWeb&&(o.fullscreenWeb=!1)})),r.add(32,(function(){o.toggle=!0})),r.add(37,(function(){o.seek=o.currentTime-5})),r.add(38,(function(){o.volume+=.1})),r.add(39,(function(){o.seek=o.currentTime+5})),r.add(40,(function(){o.volume-=.1})),a(window,"keydown",(function(t){if(n.isFocus){var e=document.activeElement.tagName.toUpperCase(),i=document.activeElement.getAttribute("contenteditable");if("INPUT"!==e&&"TEXTAREA"!==e&&""!==i&&"true"!==i){var o=r.keys[t.keyCode];o&&(t.preventDefault(),o.forEach((function(t){return t()})),n.emit("hotkey",t))}}}))}))}return n(e,[{key:"add",value:function(t,e){this.keys[t]?this.keys[t].push(e):this.keys[t]=[e]}}]),e}(),Jt=function(e){function n(e){var r;return t(this,n),(r=a(this,c(n).call(this,e))).$parent=e.template.$layer,e.on("ready",(function(){e.option.layers.forEach((function(t){r.add(t)}))})),r}return u(n,e),n}(ct),Gt=function(e){function n(e){var r;return t(this,n),r=a(this,c(n).call(this,e)),m(e.template.$loading,e.icons.loading),r}return u(n,e),n}(ct),Qt=function(){function e(n){t(this,e),this.art=n,this.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;a.innerHTML=t instanceof Error?t.message.trim():t,clearTimeout(this.timer),n&&(this.timer=setTimeout((function(){e.hide()}),r)),h(o,"art-notice-show"),this.art.emit("notice:toggle",!0)}},{key:"hide",value:function(){var t=this.art.template,e=t.$player;t.$noticeInner.innerHTML="",y(e,"art-notice-show"),this.art.emit("notice:toggle",!0)}}]),e}(),Kt=function(e){function n(e){var r;return t(this,n),r=a(this,c(n).call(this,e)),m(e.template.$state,e.icons.state),r}return u(n,e),n}(ct),te=function e(n){var r=this;t(this,e);var i=Object.assign({loading:'',state:'',play:'',pause:'',volume:'',volumeClose:'',subtitle:'',screenshot:'\t',setting:'',fullscreen:'\t\t\t\t',fullscreenWeb:'\t',pip:'',prev:'',next:''},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 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;return function(t){for(var e=1;e'.concat(n.get("Flip"),'
"),click:function(t,e){var n=e.target.dataset.value;n&&(r.flip=n)},mounted:function(t){e.on("flipChange",(function(e){var n=d("button",t).find((function(t){return t.dataset.value===e}));n&&x(n.parentElement,"current")}))}})}}function re(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 ie(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e'.concat(n.get("Aspect ratio"),'
'),click:function(t,e){var n=e.target.dataset.value;n&&(r.aspectRatio=n)},mounted:function(t){e.on("aspectRatioChange",(function(e){var n=d("button",t).find((function(t){return t.dataset.value===e}));n&&x(n.parentElement,"current")}))}})}}function oe(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 ae(t){return function(e){var n=e.i18n,r=e.player,i=e.events.proxy;return function(t){for(var e=1;e'.concat(n.get("Play speed"),': 1.0x
'),mounted:function(t){var n=p(".art-setting-range input",t),o=p(".art-subtitle-value",t);i(n,"change",(function(){var t=n.value;o.innerText=t,r.playbackRate=Number(t)})),e.on("playbackRateChange",(function(t){n.value!==t&&(n.value=t,o.innerText=t)}))}})}}var ce=function(e){function n(e){var r;t(this,n),r=a(this,c(n).call(this,e));var i=e.option,o=e.template,s=o.$setting,u=o.$settingBody,l=e.events.proxy;return r.$parent=u,i.setting&&(e.on("ready",(function(){l(s,"click",(function(t){t.target===s&&(r.show=!1)})),r.add(ne({disable:!i.flip,name:"flip"})),r.add(ie({disable:!i.aspectRatio,name:"aspectRatio"})),r.add(ae({disable:!i.playbackRate,name:"playbackRate"}))})),e.on("blur",(function(){r.show=!1}))),r}return u(n,e),n}(ct),se=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(),st({},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 ue(t){var e=t.i18n,n=t.subtitle,r=t.events.proxy;return{title:"Subtitle",name:"subtitleOffset",index:20,html:'
'.concat(e.get("Subtitle offset time"),': 0s
'),mounted:function(e){var i=p(".art-setting-range input",e),o=p(".art-subtitle-value",e);r(i,"change",(function(){var e=i.value;o.innerText=e,t.plugins.subtitleOffset.offset(Number(e))})),t.on("subtitle:switch",(function(){i.value=0,o.innerText=0})),t.on("subtitleOffset",(function(t){n.update(),i.value!==t&&(i.value=t,o.innerText=t)}))}}}function le(t){var e=t.constructor.utils.clamp,n=t.setting,r=t.notice,i=t.template,o=t.i18n,a=t.player;n.add(ue);var c=[];return t.on("subtitle:switch",(function(){c=[]})),{name:"subtitleOffset",offset:function(n){if(i.$track&&i.$track.track){var s=Array.from(i.$track.track.cues),u=e(n,-5,5);s.forEach((function(t,n){c[n]||(c[n]={startTime:t.startTime,endTime:t.endTime}),t.startTime=e(c[n].startTime+u,0,a.duration),t.endTime=e(c[n].endTime+u,0,a.duration)})),r.show("".concat(o.get("Subtitle offset time"),": ").concat(n,"s")),t.emit("subtitleOffset",n)}else r.show("".concat(o.get("No subtitles found"))),t.emit("subtitleOffset",0)}}}function fe(t){var e=t.events.proxy,n=t.template,r=t.player,i=t.option,o=t.setting,a=t.i18n;function c(e){if(e){var o=n.$video.canPlayType(e.type);if("maybe"===o||"probably"===o){var a=URL.createObjectURL(e);i.title=e.name,r.switchUrl(a,e.name),t.emit("localVideo",e)}else S(!1,"Playback of this file format is not supported")}}function s(t){var n=m(t,'');g(t,"position","relative"),b(n,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(n,"change",(function(){c(n.files[0])}))}return e(n.$player,"dragover",(function(t){t.preventDefault()})),e(n.$player,"drop",(function(t){t.preventDefault(),c(t.dataTransfer.files[0])})),t.on("ready",(function(){o.add({title:"Local Video",name:"localVideo",index:30,html:'
'.concat(a.get("Local Video"),'
').concat(a.get("Open"),'
'),mounted:function(e){var n=p(".art-upload-btn",e),r=p(".art-upload-value",e);t.on("localVideo",(function(t){r.textContent=t.name,r.title=t.name})),s(n)}})})),{name:"localVideo",attach:s}}function pe(t){var e=t.events.proxy,n=t.subtitle,r=t.setting,i=t.i18n;function o(r){var i=m(r,'');g(r,"position","relative"),b(i,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(i,"change",(function(){!function(r){if(r){var i=D(r.name);if(["ass","vtt","srt"].includes(i)){var o=new FileReader;e(o,"load",(function(e){var o=e.target.result;switch(i){case"srt":var a=R($(o));n.switch(a,r.name);break;case"ass":var c=R(T(o));n.switch(c,r.name);break;case"vtt":var s=R(o);n.switch(s,r.name)}t.emit("localSubtitle",r)})),o.readAsText(r)}else S(!1,"Only supports subtitle files in .ass, .vtt and .srt format")}}(i.files[0])}))}return t.on("ready",(function(){r.add({title:"Local Subtitle",name:"localSubtitle",index:40,html:'
'.concat(i.get("Local Subtitle"),'
').concat(i.get("Open"),'
'),mounted:function(e){var n=p(".art-upload-btn",e),r=p(".art-upload-value",e);t.on("localSubtitle",(function(t){r.textContent=t.name,r.title=t.name})),o(n)}})})),{name:"localSubtitle",attach:o}}function de(t){var e=t.layers,n=t.player,r=t.option.theme;return e.add({name:"miniProgressBar",style:{display:"none",position:"absolute",left:0,right:0,bottom:0,height:"2px",background:r},mounted:function(e){t.on("control:toggle",(function(t){e.style.display=t?"none":"block"})),t.on("destroy",(function(){e.style.display="none"})),t.on("video:timeupdate",(function(){e.style.width="".concat(100*n.played,"%")}))}}),{name:"miniProgressBar"}}function he(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 ye(t){var e=t.events,n=t.player,r=t.template,i=I((function(){var e=r.$player.getBoundingClientRect();e.top+e.height<=0&&!n.pip?(n.pip=!0,t.emit("autoPip",!0)):n.pip&&(n.pip=!1,t.emit("autoPip",!1))}),300);return e.proxy(window,"scroll",i),{name:"autoPip"}}var ve=function(){function e(n){var r=this;t(this,e),this.art=n,this.id=0;var i=n.option;i.subtitle.url&&i.subtitleOffset&&this.add(le),!i.isLive&&i.miniProgressBar&&this.add(de),i.localVideo&&this.add(fe),i.localSubtitle&&this.add(pe),i.networkMonitor&&this.add(he),i.autoPip&&this.add(ye),n.option.plugins.forEach((function(t){r.add(t)}))}return n(e,[{key:"add",value:function(t){this.id+=1;var e=t.call(this,this.art),n="";return S(!V(this,n=e&&e.name?e.name:t.name?t.name:"plugin".concat(this.id)),"Cannot add a plugin that already has the same name: ".concat(n)),Object.defineProperty(this,n,{value:e}),this.art.emit("plugin:add",t),this}}]),e}(),me=function e(n){t(this,e);var r=n.option,i=n.events.proxy,o=n.template.$video;J.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=U(r.volume,0,1)),r.poster&&(o.poster=r.poster),r.autoplay&&(o.autoplay=r.autoplay),o.controls=!0;var a=r.type||D(r.url),c=r.customType[a];a&&c?(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))},ge=0,be=function(e){function r(e){var n;return t(this,r),(n=a(this,c(r).call(this))).option=l(H(r.option,e),Z),n.isFocus=!1,n.isDestroy=!1,n.whitelist=new G(o(n)),n.template=new Q(o(n)),n.events=new Yt(o(n)),n.whitelist.state?(n.storage=new se(o(n)),n.icons=new te(o(n)),n.i18n=new et(o(n)),n.notice=new Qt(o(n)),n.player=new it(o(n)),n.layers=new Jt(o(n)),n.controls=new At(o(n)),n.contextmenu=new Ut(o(n)),n.subtitle=new Xt(o(n)),n.info=new _t(o(n)),n.loading=new Gt(o(n)),n.hotkey=new Zt(o(n)),n.mask=new Kt(o(n)),n.setting=new ce(o(n)),n.plugins=new ve(o(n))):n.mobile=new me(o(n)),ge+=1,n.id=ge,r.instances.push(o(n)),n}return u(r,e),n(r,[{key:"destroy",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.events.destroy(),this.template.destroy(t),r.instances.splice(r.instances.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}],[{key:"version",get:function(){return"3.2.4"}},{key:"env",get:function(){return'"production"'}},{key:"config",get:function(){return J}},{key:"utils",get:function(){return X}},{key:"scheme",get:function(){return Z}},{key:"Emitter",get:function(){return f}},{key:"validator",get:function(){return l}},{key:"kindOf",get:function(){return l.kindOf}},{key:"option",get:function(){return{container:"#artplayer",url:"",poster:"",title:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,loop:!1,flip:!1,playbackRate:!1,aspectRatio:!1,screenshot:!1,setting:!1,hotkey:!0,pip:!1,mutex:!0,fullscreen:!1,fullscreenWeb:!1,subtitleOffset:!1,miniProgressBar:!1,localVideo:!1,localSubtitle:!1,autoPip:!1,networkMonitor:!1,layers:[],contextmenu:[],quality:[],controls:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,width:160,height:90,column:10},subtitle:{url:"",style:{}},moreVideoAttr:{controls:!1,preload:"metadata"},icons:{},customType:{},lang:navigator.language.toLowerCase()}}}]),r}(f);return Object.defineProperty(be,"instances",{value:[]}),console.log("%c ArtPlayer %c 3.2.4 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),be})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Artplayer=e()}(this,(function(){"use strict";var t=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function e(t,e){for(var n=0;n1?n-1:0),i=1;i1&&void 0!==arguments[1]?arguments[1]:document).querySelector(t)}function d(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(e.querySelectorAll(t))}function h(t,e){return t.classList.add(e)}function y(t,e){return t.classList.remove(e)}function v(t,e){return t.classList.contains(e)}function m(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function g(t,e,n){return t.style[e]=n,t}function b(t,e){return Object.keys(e).forEach((function(n){g(t,n,e[n])})),t}function w(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=window.getComputedStyle(t,null).getPropertyValue(e);return n?parseFloat(r):r}function O(t){return Array.from(t.parentElement.children).filter((function(e){return e!==t}))}function j(t,e){O(t).forEach((function(t){return y(t,e)})),h(t,e)}function x(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"up";t.setAttribute("aria-label",e),t.setAttribute("data-balloon-pos",n)}var k=function(t){return-1!==Function.toString.call(t).indexOf("[native code]")},P=r((function(t){function e(n,r,i){return!function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}()?t.exports=e=function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&s(i,n.prototype),i}:t.exports=e=Reflect.construct,e.apply(null,arguments)}t.exports=e})),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 P(t,arguments,c(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),s(e,t)},e(n)}t.exports=e}))(Error));function 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 L=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e1?e-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(e){return setTimeout(e,t)}))}function I(t,e,n){var r;function i(){for(var i=arguments.length,o=new Array(i),a=0;a0?[e,n,r]:[n,r]).map((function(t){return t<10?"0".concat(t):String(t)})).join(":")}var X=Object.freeze({__proto__:null,query:p,queryAll:d,addClass:h,removeClass:y,hasClass:v,append:m,remove:function(t){return t.parentNode.removeChild(t)},setStyle:g,setStyles:b,getStyle:w,sublings:O,inverseClass:j,tooltip:x,ArtPlayerError:E,errorHandle:S,srtToVtt:$,vttToBlob:R,assToVtt:T,getExt:D,downloadFile:C,def:q,has:V,proxyPropertys:F,mergeDeep:H,sleep:B,debounce:I,throttle:N,clamp:U,secondToTime:_});function Y(t,e,n){return S("string"===e||t instanceof Element,"".concat(n.join(".")," require 'string' or 'Element' type"))}var Z={container:Y,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:Y,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined"}],contextmenu:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:Y,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:Y,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"},J={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"]}},G=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}}))},Q=function(){function e(n){var r=this;t(this,e),this.art=n,n.option.container instanceof Element?this.$container=n.option.container:(this.$container=p(n.option.container),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='
Player version:
3.2.4
Video url:
Video volume:
Video time:
Video duration:
Video resolution:
x
[x]
xD7
'),this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video"),this.$track=this.query(".art-video track"),this.$subtitle=this.query(".art-subtitle"),this.$danmuku=this.query(".art-danmuku"),this.$bottom=this.query(".art-bottom"),this.$progress=this.query(".art-progress"),this.$controls=this.query(".art-controls"),this.$controlsLeft=this.query(".art-controls-left"),this.$controlsRight=this.query(".art-controls-right"),this.$layer=this.query(".art-layers"),this.$loading=this.query(".art-loading"),this.$notice=this.query(".art-notice"),this.$noticeInner=this.query(".art-notice-inner"),this.$mask=this.query(".art-mask"),this.$state=this.query(".art-state"),this.$setting=this.query(".art-settings"),this.$settingInner=this.query(".art-setting-inner"),this.$settingBody=this.query(".art-setting-body"),this.$info=this.query(".art-info"),this.$infoPanel=this.query(".art-info-panel"),this.$infoClose=this.query(".art-info-close"),this.$pipHeader=this.query(".art-pip-header"),this.$pipTitle=this.query(".art-pip-title"),this.$pipClose=this.query(".art-pip-close"),this.$contextmenu=this.query(".art-contextmenus")}},{key:"initMobile",value:function(){this.$container.innerHTML='
',this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video")}},{key:"destroy",value:function(t){t?this.$container.innerHTML="":h(this.$player,"art-destroy")}}]),e}(),K={"About author":"关于作者","Video info":"视频统计信息",Close:"关闭","Video load failed":"视频加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音",Flip:"视频翻转",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新连接","Hide subtitle":"隐藏字幕","Show subtitle":"显示字幕","Hide danmu":"隐藏弹幕","Show danmu":"显示弹幕","Show setting":"显示设置","Hide setting":"隐藏设置",Screenshot:"截图","Play speed":"播放速度","Aspect ratio":"画面比例",Default:"默认",Normal:"正常",Open:"打开","Switch video":"切换","Switch subtitle":"切换字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"网页全屏","Exit web fullscreen":"退出网页全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏","Local Subtitle":"本地字幕","Local Video":"本地视频","Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},tt={"About author":"關於作者","Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"影片翻轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide subtitle":"隱藏字幕","Show subtitle":"顯示字幕","Hide danmu":"隱藏彈幕","Show danmu":"顯示彈幕","Show setting":"顯示设置","Hide setting":"隱藏设置",Screenshot:"截圖","Play speed":"播放速度","Aspect ratio":"畫面比例",Default:"默認",Normal:"正常",Open:"打開","Switch video":"切換","Switch subtitle":"切換字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"網頁全屏","Exit web fullscreen":"退出網頁全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏","Local Subtitle":"本地字幕","Local Video":"本地視頻","Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"},et=function(){function e(n){t(this,e),this.art=n,this.languages={"zh-cn":K,"zh-tw":tt},this.init()}return n(e,[{key:"init",value:function(){var t=this.art.option.lang.toLowerCase();this.language=this.languages[t]||{}}},{key:"get",value:function(t){return this.language[t]||t}},{key:"update",value:function(t){this.languages=H(this.languages,t),this.init()}}]),e}();var nt=r((function(t){!function(){var e="undefined"!=typeof window&&void 0!==window.document?window.document:{},n=t.exports,r=function(){for(var t,n=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],r=0,i=n.length,o={};rh){var y=h*l/u;g(r,"width","".concat(100*y,"%")),g(r,"height","100%"),g(r,"padding","0 ".concat((f-f*y)/2,"px"))}else{var v=u/h/l;g(r,"width","100%"),g(r,"height","".concat(100*v,"%")),g(r,"padding","".concat((p-p*v)/2,"px 0"))}}i.dataset.aspectRatio=n,a.show("".concat(o.get("Aspect ratio"),": ").concat("default"===n?o.get("Default"):n)),t.emit("aspectRatioChange",n)}else e.aspectRatio&&(g(r,"width",null),g(r,"height",null),g(r,"padding",null),delete i.dataset.aspectRatio,t.emit("aspectRatioRemove"))}}),q(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;q(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}}}),q(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)}}))}}),q(e,"screenshot",{value:function(){var r=e.getScreenshotDataURL();r&&(C(r,"".concat(n.title||"artplayer","_").concat(_(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("fullscreenChange",nt.isFullscreen)},c=function(){r.show(n.get("Does not support fullscreen"))};e.fullscreenIsEnabled&&(nt.on("change",a),nt.on("error",c),i.push((function(){nt.off("change",a),nt.off("error",c)}))),q(e,"fullscreen",{get:function(){return nt.isFullscreen},set:function(n){e.fullscreenIsEnabled?n?(e.fullscreenWeb&&(e.fullscreenWeb=!1),nt.request(o).then((function(){h(o,"art-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenEnabled")}))):(e.fullscreenWeb&&(e.fullscreenWeb=!1),nt.exit().then((function(){y(o,"art-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenExit")}))):c()}}),q(e,"fullscreenToggle",{set:function(t){t&&(e.fullscreen=!e.fullscreen)}}),q(e,"fullscreenIsEnabled",{get:function(){return nt.isEnabled}})}(n,this),function(t,e){var n=t.template.$player;q(e,"fullscreenWeb",{get:function(){return v(n,"art-web-fullscreen")},set:function(r){r?(e.fullscreen&&(e.fullscreen=!1),h(n,"art-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWebEnabled")):(e.fullscreen&&(e.fullscreen=!1),y(n,"art-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWebExit"))}}),q(e,"fullscreenWebToggle",{set:function(t){t&&(e.fullscreenWeb=!e.fullscreenWeb)}})}(n,this),rt(n,this),function(t,e){var n=t.template.$video;q(e,"loaded",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1)/n.duration:0}}),q(e,"loadedTime",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1):0}})}(n,this),function(t,e){q(e,"played",{get:function(){return t.template.$video.currentTime/t.template.$video.duration}})}(n,this),function(t,e){var n=t.template.$video;q(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;q(e,"autoSize",{get:function(){return v(r,"art-auto-size")},set:function(n){if(n){var a=o.videoWidth,c=o.videoHeight,s=r.getBoundingClientRect(),u=s.width,l=s.height,f=a/c,p=u/l;if(h(r,"art-auto-size"),p>f){g(i,"width","".concat(l*f/u*100,"%")),g(i,"height","100%")}else{var d=u/f/l*100;g(i,"width","100%"),g(i,"height","".concat(d,"%"))}t.emit("autoSizeChange",{width:e.width,height:e.height})}else y(r,"art-auto-size"),g(i,"width",null),g(i,"height",null),t.emit("autoSizeRemove")}})}(n,this),function(t,e){q(e,"rect",{get:function(){return t.template.$player.getBoundingClientRect()}}),["bottom","height","left","right","top","width"].forEach((function(t){q(e,t,{get:function(){return e.rect[t]}})})),q(e,"x",{get:function(){return e.left+window.pageXOffset}}),q(e,"y",{get:function(){return e.top+window.pageYOffset}})}(n,this),function(t,e){q(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),F(n,this)};var ot=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=c(t)););return t},at=r((function(t){function e(n,r,i){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=e=Reflect.get:t.exports=e=function(t,e,n){var r=ot(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}},e(n,r,i||n)}t.exports=e})),ct=function(){function e(n){t(this,e),this.id=0,this.art=n,this.add=this.add.bind(this),this.name=this.constructor.name.toLowerCase()}return n(e,[{key:"toggle",value:function(){this.show=!this.show}},{key:"add",value:function(t,e){var n=this,r="function"==typeof t?t(this.art):t;if(!this.$parent||r.disable)return{};this.id+=1;var i=r.name||"".concat(this.name).concat(this.id);S(!V(this,i),"Cannot add a component that already has the same name: ".concat(i));var o=document.createElement("div");o.classList.value="art-".concat(this.name," art-").concat(this.name,"-").concat(i),r.html&&m(o,r.html),r.style&&b(o,r.style),r.tooltip&&x(o,r.tooltip);var a=Array.from(this.$parent.children);o.dataset.index=r.index||this.id;var c=a.find((function(t){return Number(t.dataset.index)>=Number(o.dataset.index)}));return c?c.insertAdjacentElement("beforebegin",o):m(this.$parent,o),r.click&&this.art.events.proxy(o,"click",(function(t){t.preventDefault(),r.click.call(n.art,n,t)})),r.mounted&&r.mounted(o,this,this.art),e&&e(o,this,this.art),q(this,i,{value:{get $ref(){return o},set show(t){g(o,"display",t?"block":"none")}}}),this.art.emit("".concat(this.name,":add"),r),this[i]}},{key:"show",get:function(){return v(this.art.template.$player,"art-".concat(this.name,"-show"))},set:function(t){S(!1===t||!0===t,"The show attribute expects a boolean value");var e=this.art.template.$player,n="art-".concat(this.name,"-show");t?h(e,n):y(e,n),this.art.emit("".concat(this.name,":toggle"),t)}}]),e}();var st=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};function ut(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function lt(t){return function(e){return function(t){for(var e=1;e
'),mounted:function(t){var n=!1,i=p(".art-progress-loaded",t),c=p(".art-progress-played",t),s=p(".art-progress-highlight",t),u=p(".art-progress-indicator",t),l=p(".art-progress-tip",t);function f(t,e){"loaded"===t&&g(i,"width","".concat(100*e,"%")),"played"===t&&(g(c,"width","".concat(100*e,"%")),g(u,"left","calc(".concat(100*e,"% - ").concat(w(u,"width")/2,"px)")))}r.forEach((function(t){var e=U(t.time,0,a.duration)/a.duration*100;m(s,''))})),f("loaded",a.loaded),e.on("video:progress",(function(){f("loaded",a.loaded)})),e.on("video:timeupdate",(function(){f("played",a.played)})),e.on("video:ended",(function(){f("played",1)})),o(t,"mousemove",(function(n){g(l,"display","block"),n.composedPath().indexOf(s)>-1?function(n){var r=gt(e,n).width,i=n.target.dataset.text;l.innerHTML=i;var o=l.clientWidth;r<=o/2?g(l,"left",0):r>t.clientWidth-o/2?g(l,"left","".concat(t.clientWidth-o,"px")):g(l,"left","".concat(r-o/2,"px"))}(n):function(n){var r=gt(e,n),i=r.width,o=r.time;l.innerHTML=o;var a=l.clientWidth;i<=a/2?g(l,"left",0):i>t.clientWidth-a/2?g(l,"left","".concat(t.clientWidth-a,"px")):g(l,"left","".concat(i-a/2,"px"))}(n)})),o(t,"mouseout",(function(){g(l,"display","none")})),o(t,"click",(function(t){if(t.target!==u){var n=gt(e,t),r=n.second;f("played",n.percentage),a.seek=r}})),o(u,"mousedown",(function(){n=!0})),o(document,"mousemove",(function(t){if(n){var r=gt(e,t),i=r.second,o=r.percentage;h(u,"art-show-indicator"),f("played",o),a.seek=i}})),o(document,"mouseup",(function(){n&&(n=!1,y(u,"art-show-indicator"))}))}})}}function wt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ot(t){return function(e){return function(t){for(var e=1;e'),l=m(u,'
');function f(t){var e=u.getBoundingClientRect(),n=e.left,r=e.width,i=l.getBoundingClientRect().width;return U(t.pageX-n-i/2,0,r-i/2)/(r-i)}function p(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.7;if(i.muted||0===t)g(c,"display","none"),g(s,"display","flex"),g(l,"left","0");else{var e=((w(u,"width")||60)-w(l,"width"))*t;g(c,"display","flex"),g(s,"display","none"),g(l,"left","".concat(e,"px"))}}x(c,o.get("Mute")),g(s,"display","none"),p(i.volume),e.on("video:volumechange",(function(){p(i.volume)})),n(c,"click",(function(){i.muted=!0})),n(s,"click",(function(){i.muted=!1})),n(u,"click",(function(t){i.muted=!1,i.volume=f(t)})),n(l,"mousedown",(function(){a=!0})),n(document,"mousemove",(function(t){a&&(i.muted=!1,i.volume=f(t))})),n(document,"mouseup",(function(){a&&(a=!1)}))}})}}function 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;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 Tt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Dt(t){return function(e){return function(t){for(var e=1;e'.concat(s.name,"")),l=n.map((function(t,e){return'
').concat(t.name,"
")})).join(""),f=m(t,'
'.concat(l,"
"));o(t,(function(){f.style.left="-".concat(w(f,"width")/2-t.clientWidth/2,"px")})),i(f,"click",(function(t){var e=Number(t.target.dataset.index),r=n[e],i=r.url,o=r.name;i&&o&&c!==e&&(a.switchQuality(i,o),u.innerHTML=o,c=e)}))}})}}var At=function(e){function r(e){var n;t(this,r),n=a(this,c(r).call(this,e));var i=e.option;return e.on("ready",(function(){n.add(bt({name:"progress",disable:i.isLive,position:"top",index:10})),n.add(Rt({name:"thumbnails",disable:!i.thumbnails.url||i.isLive,position:"top",index:20})),n.add(vt({name:"playAndPause",disable:!1,position:"left",index:10})),n.add(Pt({name:"volume",disable:!1,position:"left",index:20})),n.add(xt({name:"time",disable:i.isLive,position:"left",index:30})),n.add(Lt({name:"quality",disable:0===i.quality.length,position:"right",index:10})),n.add(Dt({name:"screenshot",disable:!i.screenshot,position:"right",index:20})),n.add(Ot({name:"subtitle",disable:!i.subtitle.url,position:"right",index:30})),n.add(St({name:"setting",disable:!i.setting,position:"right",index:40})),n.add(ht({name:"pip",disable:!i.pip,position:"right",index:50})),n.add(pt({name:"fullscreenWeb",disable:!i.fullscreenWeb,position:"right",index:60})),n.add(lt({name:"fullscreen",disable:!i.fullscreen,position:"right",index:70})),i.controls.forEach((function(t){n.add(t)}))})),n}return u(r,e),n(r,[{key:"add",value:function(t,e){var n="function"==typeof t?t(this.art):t;S(n.position,"Controls option.position can not be empty");var i=this.art.template,o=i.$progress,a=i.$controlsLeft,s=i.$controlsRight;switch(n.position){case"top":this.$parent=o;break;case"left":this.$parent=a;break;case"right":this.$parent=s}var u=at(c(r.prototype),"add",this).call(this,n,e);return n.disable||"top"===n.position||u.$ref.firstElementChild&&"I"===u.$ref.firstElementChild.tagName||h(u.$ref,"art-control-onlyText"),u}}]),r}(ct);function Mt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function zt(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e0.50.75').concat(n.get("Normal"),'1.251.52.0'),click:function(t,e){var n=e.target.dataset.rate;n&&(r.playbackRate=Number(n),t.show=!1)},mounted:function(t){e.on("playbackRateChange",(function(e){var n=d("span",t).find((function(t){return Number(t.dataset.rate)===e}));n&&j(n,"art-current")}))}})}}function qt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Wt(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e').concat(n.get("Default"),'4:316:9'),click:function(t,e){var n=e.target.dataset.ratio;n&&(r.aspectRatio=n,t.show=!1)},mounted:function(t){e.on("aspectRatioChange",(function(e){var n=d("span",t).find((function(t){return t.dataset.ratio===e}));n&&j(n,"art-current")}))}})}}function Vt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ft(t){return function(e){return function(t){for(var e=1;eArtPlayer 3.2.4'})}function It(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 Nt(t){return function(e){return function(t){for(var e=1;ec+a&&(h=a-d),n+p>l+o&&(y=o-p),g(u,"left","".concat(h,"px")),g(u,"top","".concat(y,"px"))})),l(s,"click",(function(t){t.composedPath().includes(u)||(r.show=!1)})),e.on("blur",(function(){r.show=!1}))})),r}return u(n,e),n}(ct),_t=function(e){function n(e){var r;t(this,n),r=a(this,c(n).call(this,e));var i=e.template,o=i.$infoPanel,s=i.$infoClose,u=i.$video;(0,e.events.proxy)(s,"click",(function(){r.show=!1}));var l=null,f=d("[data-video]",o);return e.on("destroy",(function(){clearTimeout(l)})),e.on("info:toggle",(function(t){clearTimeout(l),t&&function t(){f.forEach((function(t){var e=u[t.dataset.video];t.innerHTML="number"==typeof e?e.toFixed(2):e})),l=setTimeout((function(){t()}),1e3)}()})),r}return u(n,e),n}(ct),Xt=function(e){function r(e){var n;t(this,r),n=a(this,c(r).call(this,e));var i=e.events.proxy,s=e.option.subtitle;return b(e.template.$subtitle,s.style),i(n.textTrack,"cuechange",n.update.bind(o(n))),s.url&&n.init(s.url),n}return u(r,e),n(r,[{key:"update",value:function(){var t=this.art.template.$subtitle;t.innerHTML="",this.activeCue&&(t.innerHTML=this.activeCue.text.split(/\r?\n/).map((function(t){return"

".concat(t,"

")})).join(""),this.art.emit("subtitle:update",this.activeCue.text))}},{key:"switch",value:function(t,e){var n=this,r=this.art,i=r.i18n,o=r.notice;return this.init(t).then((function(t){return e&&o.show("".concat(i.get("Switch subtitle"),": ").concat(e)),n.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(n){switch(e.art.emit("subtitle:load",t),D(t)){case"srt":return R($(n));case"ass":return R(T(n));case"vtt":return R(n);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),e.art.emit("subtitle:err",t),t}))}},{key:"url",get:function(){return this.art.template.$track.src}},{key:"textTrack",get:function(){return this.art.template.$video.textTracks[0]}},{key:"activeCue",get:function(){return this.textTrack.activeCues[0]}}]),r}(ct);var Yt=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,"art-hover"),t.emit("hoverenter")}),(function(){y(n,"art-hover"),t.emit("hoverleave")}))}(n,r),function(t,e){var n=t.template,r=n.$player,i=n.$video,o=t.player,a=I((function(){h(r,"art-hide-cursor"),y(r,"art-hover"),t.controls.show=!1}),3e3);t.on("hoverleave",(function(){o.playing&&a()})),e.proxy(r,"mousemove",(function(e){a.clearTimeout(),y(r,"art-hide-cursor"),t.controls.show=!0,!t.player.pip&&o.playing&&e.target===i&&a(),t.emit("mousemove")}))}(n,r),function(t,e){var n=t.option,r=t.player,i=t.template.$player,o=document.createElement("object");o.setAttribute("aria-hidden","true"),o.setAttribute("tabindex",-1),o.type="text/html",o.data="about:blank";var a=r.width,c=r.height,s=N((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}(),Zt=function(){function e(n){var r=this;t(this,e),this.keys={};var i=n.option,o=n.player,a=n.events.proxy;i.hotkey&&n.on("ready",(function(){r.add(27,(function(){o.fullscreenWeb&&(o.fullscreenWeb=!1)})),r.add(32,(function(){o.toggle=!0})),r.add(37,(function(){o.seek=o.currentTime-5})),r.add(38,(function(){o.volume+=.1})),r.add(39,(function(){o.seek=o.currentTime+5})),r.add(40,(function(){o.volume-=.1})),a(window,"keydown",(function(t){if(n.isFocus){var e=document.activeElement.tagName.toUpperCase(),i=document.activeElement.getAttribute("contenteditable");if("INPUT"!==e&&"TEXTAREA"!==e&&""!==i&&"true"!==i){var o=r.keys[t.keyCode];o&&(t.preventDefault(),o.forEach((function(t){return t()})),n.emit("hotkey",t))}}}))}))}return n(e,[{key:"add",value:function(t,e){this.keys[t]?this.keys[t].push(e):this.keys[t]=[e]}}]),e}(),Jt=function(e){function n(e){var r;return t(this,n),(r=a(this,c(n).call(this,e))).$parent=e.template.$layer,e.on("ready",(function(){e.option.layers.forEach((function(t){r.add(t)}))})),r}return u(n,e),n}(ct),Gt=function(e){function n(e){var r;return t(this,n),r=a(this,c(n).call(this,e)),m(e.template.$loading,e.icons.loading),r}return u(n,e),n}(ct),Qt=function(){function e(n){t(this,e),this.art=n,this.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;a.innerHTML=t instanceof Error?t.message.trim():t,clearTimeout(this.timer),n&&(this.timer=setTimeout((function(){e.hide()}),r)),h(o,"art-notice-show"),this.art.emit("notice:toggle",!0)}},{key:"hide",value:function(){var t=this.art.template,e=t.$player;t.$noticeInner.innerHTML="",y(e,"art-notice-show"),this.art.emit("notice:toggle",!0)}}]),e}(),Kt=function(e){function n(e){var r;return t(this,n),r=a(this,c(n).call(this,e)),m(e.template.$state,e.icons.state),r}return u(n,e),n}(ct),te=function e(n){var r=this;t(this,e);var i=Object.assign({loading:'',state:'',play:'',pause:'',volume:'',volumeClose:'',subtitle:'',screenshot:'\t',setting:'',fullscreen:'\t\t\t\t',fullscreenWeb:'\t',pip:'',prev:'',next:''},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 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;return function(t){for(var e=1;e'.concat(n.get("Flip"),'
"),click:function(t,e){var n=e.target.dataset.value;n&&(r.flip=n)},mounted:function(t){e.on("flipChange",(function(e){var n=d("button",t).find((function(t){return t.dataset.value===e}));n&&j(n.parentElement,"current")}))}})}}function re(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 ie(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e'.concat(n.get("Aspect ratio"),'
'),click:function(t,e){var n=e.target.dataset.value;n&&(r.aspectRatio=n)},mounted:function(t){e.on("aspectRatioChange",(function(e){var n=d("button",t).find((function(t){return t.dataset.value===e}));n&&j(n.parentElement,"current")}))}})}}function oe(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 ae(t){return function(e){var n=e.i18n,r=e.player,i=e.events.proxy;return function(t){for(var e=1;e'.concat(n.get("Play speed"),': 1.0x
'),mounted:function(t){var n=p(".art-setting-range input",t),o=p(".art-subtitle-value",t);i(n,"change",(function(){var t=n.value;o.innerText=t,r.playbackRate=Number(t)})),e.on("playbackRateChange",(function(t){n.value!==t&&(n.value=t,o.innerText=t)}))}})}}var ce=function(e){function n(e){var r;t(this,n),r=a(this,c(n).call(this,e));var i=e.option,o=e.template,s=o.$setting,u=o.$settingBody,l=e.events.proxy;return r.$parent=u,i.setting&&(e.on("ready",(function(){l(s,"click",(function(t){t.target===s&&(r.show=!1)})),r.add(ne({disable:!i.flip,name:"flip"})),r.add(ie({disable:!i.aspectRatio,name:"aspectRatio"})),r.add(ae({disable:!i.playbackRate,name:"playbackRate"}))})),e.on("blur",(function(){r.show=!1}))),r}return u(n,e),n}(ct),se=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(),st({},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 ue(t){var e=t.i18n,n=t.subtitle,r=t.events.proxy;return{title:"Subtitle",name:"subtitleOffset",index:20,html:'
'.concat(e.get("Subtitle offset time"),': 0s
'),mounted:function(e){var i=p(".art-setting-range input",e),o=p(".art-subtitle-value",e);r(i,"change",(function(){var e=i.value;o.innerText=e,t.plugins.subtitleOffset.offset(Number(e))})),t.on("subtitle:switch",(function(){i.value=0,o.innerText=0})),t.on("subtitleOffset",(function(t){n.update(),i.value!==t&&(i.value=t,o.innerText=t)}))}}}function le(t){var e=t.constructor.utils.clamp,n=t.setting,r=t.notice,i=t.template,o=t.i18n,a=t.player;n.add(ue);var c=[];return t.on("subtitle:switch",(function(){c=[]})),{name:"subtitleOffset",offset:function(n){if(i.$track&&i.$track.track){var s=Array.from(i.$track.track.cues),u=e(n,-5,5);s.forEach((function(t,n){c[n]||(c[n]={startTime:t.startTime,endTime:t.endTime}),t.startTime=e(c[n].startTime+u,0,a.duration),t.endTime=e(c[n].endTime+u,0,a.duration)})),r.show("".concat(o.get("Subtitle offset time"),": ").concat(n,"s")),t.emit("subtitleOffset",n)}else r.show("".concat(o.get("No subtitles found"))),t.emit("subtitleOffset",0)}}}function fe(t){var e=t.events.proxy,n=t.template,r=t.player,i=t.option,o=t.setting,a=t.i18n;function c(e){if(e){var o=n.$video.canPlayType(e.type);if("maybe"===o||"probably"===o){var a=URL.createObjectURL(e);i.title=e.name,r.switchUrl(a,e.name),t.emit("localVideo",e)}else S(!1,"Playback of this file format is not supported")}}function s(t){var n=m(t,'');g(t,"position","relative"),b(n,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(n,"change",(function(){c(n.files[0])}))}return e(n.$player,"dragover",(function(t){t.preventDefault()})),e(n.$player,"drop",(function(t){t.preventDefault(),c(t.dataTransfer.files[0])})),t.on("ready",(function(){o.add({title:"Local Video",name:"localVideo",index:30,html:'
'.concat(a.get("Local Video"),'
').concat(a.get("Open"),'
'),mounted:function(e){var n=p(".art-upload-btn",e),r=p(".art-upload-value",e);t.on("localVideo",(function(t){r.textContent=t.name,r.title=t.name})),s(n)}})})),{name:"localVideo",attach:s}}function pe(t){var e=t.events.proxy,n=t.subtitle,r=t.setting,i=t.i18n;function o(r){var i=m(r,'');g(r,"position","relative"),b(i,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(i,"change",(function(){!function(r){if(r){var i=D(r.name);if(["ass","vtt","srt"].includes(i)){var o=new FileReader;e(o,"load",(function(e){var o=e.target.result;switch(i){case"srt":var a=R($(o));n.switch(a,r.name);break;case"ass":var c=R(T(o));n.switch(c,r.name);break;case"vtt":var s=R(o);n.switch(s,r.name)}t.emit("localSubtitle",r)})),o.readAsText(r)}else S(!1,"Only supports subtitle files in .ass, .vtt and .srt format")}}(i.files[0])}))}return t.on("ready",(function(){r.add({title:"Local Subtitle",name:"localSubtitle",index:40,html:'
'.concat(i.get("Local Subtitle"),'
').concat(i.get("Open"),'
'),mounted:function(e){var n=p(".art-upload-btn",e),r=p(".art-upload-value",e);t.on("localSubtitle",(function(t){r.textContent=t.name,r.title=t.name})),o(n)}})})),{name:"localSubtitle",attach:o}}function de(t){var e=t.layers,n=t.player,r=t.option.theme;return e.add({name:"miniProgressBar",style:{display:"none",position:"absolute",left:0,right:0,bottom:0,height:"2px",background:r},mounted:function(e){t.on("control:toggle",(function(t){e.style.display=t?"none":"block"})),t.on("destroy",(function(){e.style.display="none"})),t.on("video:timeupdate",(function(){e.style.width="".concat(100*n.played,"%")}))}}),{name:"miniProgressBar"}}function he(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 ye(t){var e=t.events,n=t.player,r=t.template,i=I((function(){var e=r.$player.getBoundingClientRect();e.top+e.height<=0&&!n.pip?(n.pip=!0,t.emit("autoPip",!0)):n.pip&&(n.pip=!1,t.emit("autoPip",!1))}),300);return e.proxy(window,"scroll",i),{name:"autoPip"}}var ve=function(){function e(n){var r=this;t(this,e),this.art=n,this.id=0;var i=n.option;i.subtitle.url&&i.subtitleOffset&&this.add(le),!i.isLive&&i.miniProgressBar&&this.add(de),i.localVideo&&this.add(fe),i.localSubtitle&&this.add(pe),i.networkMonitor&&this.add(he),i.autoPip&&this.add(ye),n.option.plugins.forEach((function(t){r.add(t)}))}return n(e,[{key:"add",value:function(t){this.id+=1;var e=t.call(this,this.art),n="";return S(!V(this,n=e&&e.name?e.name:t.name?t.name:"plugin".concat(this.id)),"Cannot add a plugin that already has the same name: ".concat(n)),Object.defineProperty(this,n,{value:e}),this.art.emit("plugin:add",t),this}}]),e}(),me=function e(n){t(this,e);var r=n.option,i=n.events.proxy,o=n.template.$video;J.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=U(r.volume,0,1)),r.poster&&(o.poster=r.poster),r.autoplay&&(o.autoplay=r.autoplay),o.controls=!0;var a=r.type||D(r.url),c=r.customType[a];a&&c?(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))},ge=0,be=function(e){function r(e){var n;return t(this,r),(n=a(this,c(r).call(this))).option=l(H(r.option,e),Z),n.isFocus=!1,n.isDestroy=!1,n.whitelist=new G(o(n)),n.template=new Q(o(n)),n.events=new Yt(o(n)),n.whitelist.state?(n.storage=new se(o(n)),n.icons=new te(o(n)),n.i18n=new et(o(n)),n.notice=new Qt(o(n)),n.player=new it(o(n)),n.layers=new Jt(o(n)),n.controls=new At(o(n)),n.contextmenu=new Ut(o(n)),n.subtitle=new Xt(o(n)),n.info=new _t(o(n)),n.loading=new Gt(o(n)),n.hotkey=new Zt(o(n)),n.mask=new Kt(o(n)),n.setting=new ce(o(n)),n.plugins=new ve(o(n))):n.mobile=new me(o(n)),ge+=1,n.id=ge,r.instances.push(o(n)),n}return u(r,e),n(r,[{key:"destroy",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.events.destroy(),this.template.destroy(t),r.instances.splice(r.instances.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}],[{key:"version",get:function(){return"3.2.4"}},{key:"env",get:function(){return'"production"'}},{key:"config",get:function(){return J}},{key:"utils",get:function(){return X}},{key:"scheme",get:function(){return Z}},{key:"Emitter",get:function(){return f}},{key:"validator",get:function(){return l}},{key:"kindOf",get:function(){return l.kindOf}},{key:"option",get:function(){return{container:"#artplayer",url:"",poster:"",title:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,loop:!1,flip:!1,playbackRate:!1,aspectRatio:!1,screenshot:!1,setting:!1,hotkey:!0,pip:!1,mutex:!0,fullscreen:!1,fullscreenWeb:!1,subtitleOffset:!1,miniProgressBar:!1,localVideo:!1,localSubtitle:!1,autoPip:!1,networkMonitor:!1,layers:[],contextmenu:[],quality:[],controls:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,width:160,height:90,column:10},subtitle:{url:"",style:{}},moreVideoAttr:{controls:!1,preload:"metadata"},icons:{},customType:{},lang:navigator.language.toLowerCase()}}}]),r}(f);return Object.defineProperty(be,"instances",{value:[]}),console.log("%c ArtPlayer %c 3.2.4 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),be})); diff --git a/packages/artplayer/src/style/artplayer.scss b/packages/artplayer/src/style/artplayer.scss index d185f5935..508014e95 100644 --- a/packages/artplayer/src/style/artplayer.scss +++ b/packages/artplayer/src/style/artplayer.scss @@ -46,6 +46,11 @@ } } + img { + max-width: 100%; + vertical-align: top; + } + & >>> object { display: block; position: absolute;