/*!
* artplayer.js v3.1.18
* Github: https://github.com/zhw2590582/ArtPlayer#readme
* (c) 2017-2019 Harvey Zack
* Released under the MIT License.
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Artplayer=e()}(this,function(){"use strict";var a=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function r(t,e){for(var n=0;n").replace(/\{\\([ibu])1\}/g,"<$1>").replace(/\{([ibu])\}/g,"<$1>").replace(/\{\/([ibu])\}/g,"$1>").replace(/(\d\d:\d\d:\d\d),(\d\d\d)/g,"$1.$2").concat("\r\n\r\n"))}function T(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function D(t){var n=new RegExp("Dialogue:\\s\\d,(\\d+:\\d\\d:\\d\\d.\\d\\d),(\\d+:\\d\\d:\\d\\d.\\d\\d),([^,]*),([^,]*),(?:[^,]*,){4}([\\s\\S]*)$","i");function r(t){return(0\n \n \n \n \n \n \n \n \n \n \n \n \n \n '),this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video"),this.$subtitle=this.query(".artplayer-subtitle"),this.$danmuku=this.query(".artplayer-danmuku"),this.$bottom=this.query(".artplayer-bottom"),this.$progress=this.query(".artplayer-progress"),this.$controls=this.query(".artplayer-controls"),this.$controlsLeft=this.query(".artplayer-controls-left"),this.$controlsRight=this.query(".artplayer-controls-right"),this.$layers=this.query(".artplayer-layers"),this.$loading=this.query(".artplayer-loading"),this.$notice=this.query(".artplayer-notice"),this.$noticeInner=this.query(".artplayer-notice-inner"),this.$mask=this.query(".artplayer-mask"),this.$setting=this.query(".artplayer-setting"),this.$settingInner=this.query(".artplayer-setting-inner"),this.$settingBody=this.query(".artplayer-setting-body"),this.$info=this.query(".artplayer-info"),this.$infoPanel=this.query(".artplayer-info-panel"),this.$infoClose=this.query(".artplayer-info-close"),this.$pipHeader=this.query(".artplayer-pip-header"),this.$pipTitle=this.query(".artplayer-pip-title"),this.$pipClose=this.query(".artplayer-pip-close"),this.$contextmenu=this.query(".artplayer-contextmenu")}},{key:"initMobile",value:function(){this.$container.innerHTML='\n \n \n
\n ',this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video")}},{key:"destroy",value:function(t){t?this.$container.innerHTML="":m(this.$player,"artplayer-destroy")}}]),n}(),Q={"About author":"关于作者","Video info":"视频统计信息",Close:"关闭","Video load failed":"视频加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音",Flip:"视频翻转",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新连接","Hide subtitle":"隐藏字幕","Show subtitle":"显示字幕","Hide danmu":"隐藏弹幕","Show danmu":"显示弹幕","Show setting":"显示设置","Hide setting":"隐藏设置",Screenshot:"截图","Play speed":"播放速度","Aspect ratio":"画面比例",Default:"默认",Normal:"正常","Switch video":"切换","Switch subtitle":"切换字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"网页全屏","Exit web fullscreen":"退出网页全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},K={"About author":"關於作者","Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"影片翻轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide subtitle":"隱藏字幕","Show subtitle":"顯示字幕","Show setting":"顯示设置","Hide setting":"隱藏设置","Hide danmu":"隱藏彈幕","Show danmu":"顯示彈幕",Screenshot:"截圖","Play speed":"播放速度","Aspect ratio":"畫面比例",Default:"默認",Normal:"正常","Switch video":"切換","Switch subtitle":"切換字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"網頁全屏","Exit web fullscreen":"退出網頁全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},tt=function(){function e(t){a(this,e),this.art=t,this.languages={"zh-cn":Q,"zh-tw":K},this.init()}return i(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 et=t(function(t){var o,e,i,r,n;o="undefined"!=typeof window&&void 0!==window.document?window.document:{},e=t.exports,i=function(){for(var t,e=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],n=0,r=e.length,i={};n ").concat(s));var u=document.createElement("div");u.classList.value="art-".concat(o," art-").concat(o,"-").concat(s),a.html&&w(u,a.html),a.style&&v(u,a.style),a.tooltip&&k(u,a.tooltip);var l=Array.from(t.children);u.dataset.index=a.index||c;var f=l.find(function(t){return Number(t.dataset.index)>=Number(u.dataset.index)});return f?f.insertAdjacentElement("beforebegin",u):w(t,u),a.click&&e.events.proxy(u,"click",function(t){t.preventDefault(),a.click.call(e,n,t),e.emit("".concat(o,":click"),u)}),a.mounted&&a.mounted(u,n,e),i&&i(u,n,e),Object.defineProperty(n,s,{value:{get id(){return c},get $ref(){return u},set show(t){t?(O(u,"display","block"),e.emit("".concat(o,":show"),u)):(O(u,"display","none"),e.emit("".concat(o,":hide"),u))},set remove(t){t&&(y(u),e.emit("".concat(o,":remove"),u))}}}),e.emit("".concat(o,":add"),a),n[s]}var ot=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 at(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ct(t){return function(a){return function(e){for(var t=1;t\n \n \n \n \n \n \n '),mounted:function(o){var i=!1,n=d(".art-progress-loaded",o),r=d(".art-progress-played",o),a=d(".art-progress-highlight",o),c=d(".art-progress-indicator",o),s=d(".art-progress-tip",o);function u(t,e){"loaded"===t&&O(n,"width","".concat(100*e,"%")),"played"===t&&(O(r,"width","".concat(100*e,"%")),O(c,"left","calc(".concat(100*e,"% - ").concat(j(c,"width")/2,"px)")))}e.forEach(function(t){var e=N(t.time,0,p.duration)/p.duration*100;w(a,''))}),u("loaded",p.loaded),l.on("video:progress",function(){u("loaded",p.loaded)}),l.on("video:timeupdate",function(){u("played",p.played)}),l.on("video:ended",function(){u("played",1)}),f(o,"mousemove",function(t){O(s,"display","block"),-1o.clientWidth-r/2?O(s,"left","".concat(o.clientWidth-r,"px")):O(s,"left","".concat(e-r/2,"px"))}(t):function(t){var e=yt(l,t),n=e.width,r=e.time;s.innerHTML=r;var i=s.clientWidth;n<=i/2?O(s,"left",0):n>o.clientWidth-i/2?O(s,"left","".concat(o.clientWidth-i,"px")):O(s,"left","".concat(n-i/2,"px"))}(t)}),f(o,"mouseout",function(){O(s,"display","none")}),f(o,"click",function(t){if(t.target!==c){var e=yt(l,t),n=e.second;u("played",e.percentage),p.seek=n}}),f(c,"mousedown",function(){i=!0}),f(document,"mousemove",function(t){if(i){var e=yt(l,t),n=e.second,r=e.percentage;m(c,"art-show-indicator"),u("played",r),p.seek=n}}),f(document,"mouseup",function(){i&&(i=!1,g(c,"art-show-indicator"))})}})}}function mt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function gt(t){return function(a){return function(e){for(var t=1;t'),u=w(s,'');function l(t){var e=s.getBoundingClientRect(),n=e.left,r=e.width,i=u.getBoundingClientRect().width;return N(t.pageX-n-i/2,0,r-i/2)/(r-i)}function f(t){var e=0d.clientWidth-i/2?O(f,"left","".concat(d.clientWidth-i,"px")):O(f,"left","".concat(e-i/2,"px"))}(t))}),e(d,"mouseout",function(){O(f,"display","none")})}})}}function St(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $t(t){return function(a){return function(e){for(var t=1;t'.concat(i.name,"")),u=o.map(function(t,e){return'').concat(t.name,"
")}).join(""),l=w(t,''.concat(u,"
"));r(t,function(){l.style.left="-".concat(j(l,"width")/2-t.clientWidth/2,"px")}),n(l,"click",function(t){var e=Number(t.target.dataset.index),n=o[e],r=n.url,i=n.name;r&&i&&c!==e&&(a.switchQuality(r,i),s.innerHTML=i,c=e)})}})}}var Dt=function(){function n(t){var e=this;a(this,n),this.id=0,this.art=t,this.art.on("ready",function(){e.init()})}return i(n,[{key:"init",value:function(){var e=this,t=this.art.option;this.add(vt({name:"progress",disable:t.isLive,position:"top",index:10})),this.add(Et({name:"thumbnails",disable:!t.thumbnails.url||t.isLive,position:"top",index:20})),this.add(dt({name:"playAndPause",disable:!1,position:"left",index:10})),this.add(jt({name:"volume",disable:!1,position:"left",index:20})),this.add(wt({name:"time",disable:t.isLive,position:"left",index:30})),this.add(Tt({name:"quality",disable:0===t.quality.length,position:"right",index:10})),this.add($t({name:"screenshot",disable:!t.screenshot,position:"right",index:20})),this.add(gt({name:"subtitle",disable:!t.subtitle.url,position:"right",index:30})),this.add(kt({name:"setting",disable:!t.setting,position:"right",index:40})),this.add(ft({name:"pip",disable:!t.pip,position:"right",index:50})),this.add(ut({name:"fullscreenWeb",disable:!t.fullscreenWeb,position:"right",index:60})),this.add(ct({name:"fullscreen",disable:!t.fullscreen,position:"right",index:70})),t.controls.forEach(function(t){e.add(t)})}},{key:"add",value:function(t,e){var n,r="function"==typeof t?t(this.art):t,i=this.art.template,o=i.$progress,a=i.$controlsLeft,c=i.$controlsRight;switch(r.position){case"top":n=o;break;case"left":n=a;break;case"right":n=c}this.id+=1,$(r.position,"Controls option.position can not be empty");var s=it(this.art,this,n,r,e,"control");return r.disable||"top"===r.position||s.$ref.firstElementChild&&"I"===s.$ref.firstElementChild.tagName||m(s.$ref,"art-control-onlyText"),s}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,m(e,"artplayer-controls-show"),this.art.emit("controls:show")):(this.state=!1,g(e,"artplayer-controls-show"),this.art.emit("controls:hide"))}}]),n}();function Ct(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function At(n){return function(t){var e=t.i18n,r=t.player;return function(e){for(var t=1;t0.5\n 0.75\n ').concat(e.get("Normal"),'\n 1.25\n 1.5\n 2.0\n '),click:function(t,e){var n=e.target.dataset.rate;n&&(r.playbackRate=Number(n),t.show=!1)},mounted:function(n){t.on("playbackRateChange",function(e){var t=h("span",n).find(function(t){return Number(t.dataset.rate)===e});t&&P(t,"current")})}})}}function Lt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Mt(n){return function(t){var e=t.i18n,r=t.player;return function(e){for(var t=1;t').concat(e.get("Default"),'\n 4:3\n 16:9\n '),click:function(t,e){var n=e.target.dataset.ratio;n&&(r.aspectRatio=n,t.show=!1)},mounted:function(n){t.on("aspectRatioChange",function(e){var t=h("span",n).find(function(t){return t.dataset.ratio===e});t&&P(t,"current")})}})}}function zt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function qt(t){return function(e){return function(e){for(var t=1;tArtPlayer 3.1.18'})}function Ht(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function It(e){return function(t){return function(e){for(var t=1;t\n Player version:
\n 3.1.18
\n \n '),t.push('\n \n
Video url:
\n
'.concat(this.art.option.url,"
\n
\n ")),t.push('\n \n '),t.push('\n \n '),t.push('\n \n '),t.push('\n \n
Video resolution:
\n
\n x \n
\n
\n '),t.join("")}},{key:"readInfo",value:function(){var t=this.art.template,e=t.$infoPanel,n=t.$video;h("[data-video]",e).forEach(function(t){var e=n[t.dataset.video];t.innerHTML=void 0!==e?"number"==typeof e?e.toFixed(2):e:"unknown"})}},{key:"loop",value:function(){var t=this;this.readInfo(),this.timer=setTimeout(function(){t.readInfo(),t.loop()},1e3)}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template,n=e.$player,r=e.$infoPanel;t?(this.state=!0,m(n,"artplayer-info-show"),r.innerHTML||w(r,this.creatInfo()),clearTimeout(this.timer),this.loop(),this.art.emit("info:show")):(this.state=!1,g(n,"artplayer-info-show"),clearTimeout(this.timer),this.art.emit("info:hide"))}}]),e}();var Nt=function(t){if(Array.isArray(t))return t};var Ut=function(t,e){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)){var n=[],r=!0,i=!1,o=void 0;try{for(var a,c=t[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){i=!0,o=t}finally{try{r||null==c.return||c.return()}finally{if(i)throw o}}return n}};var _t=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")};var Xt=function(t,e){return Nt(t)||Ut(t,e)||_t()},Yt=function(){function n(t){a(this,n),this.art=t,this.state=!0,this.isInit=!1;var e=this.art.option.subtitle.url;e&&this.init(e)}return i(n,[{key:"switch",value:function(t,e){var n=1".concat(t,"
")}).join("")),this.art.emit("subtitle:update",s)},i=Xt(c.textTracks,1)[0];l.isInit||(l.isInit=!0,a(i,"cuechange",r.bind(l))),l.art.on("artplayerPluginSubtitleOffset",r.bind(l))}o(t)}})})}},{key:"load",value:function(e){var n=this.art.notice;return fetch(e).then(function(t){return t.text()}).then(function(t){switch(C(e)){case"srt":return T(R(t));case"ass":return T(D(t));case"vtt":return T(t);default:return e}}).catch(function(t){throw n.show(t),t})}},{key:"toggle",value:function(){this.show=!this.state}},{key:"url",get:function(){var t=this.art.template.$track;return t?t.src:""}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,g(e,"artplayer-subtitle-hide"),this.art.emit("subtitle:show")):(this.state=!1,m(e,"artplayer-subtitle-hide"),this.art.emit("subtitle:hide"))}}]),n}();function Zt(t){var n=this;a(this,Zt);var r=Object.assign({loading:'',state:'',play:'',pause:'',volume:'',volumeClose:'',subtitle:'',screenshot:'\n',setting:'',fullscreen:'',fullscreenWeb:'',pip:'',prev:'',next:''},t.option.icons);Object.keys(r).forEach(function(t){var e=document.createElement("i");e.classList.add("art-icon"),e.classList.add("art-icon-".concat(t)),w(e,r[t]),n[t]=e})}var Jt=function(){function n(t){var e=this;a(this,n),this.destroyEvents=[],this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),this.loadImg=this.loadImg.bind(this),t.whitelist.state&&t.once("video:canplay",function(){!function(e,t){var n=e.template.$player;t.proxy(document,["click","contextmenu"],function(t){-1');w(e,t.icons.state)}return i(n,[{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,m(e,"artplayer-mask-show"),this.art.emit("mask:show")):(this.state=!1,g(e,"artplayer-mask-show"),this.art.emit("mask:hide"))}}]),n}();function ne(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function re(n){return function(t){var e=t.i18n,r=t.player;return function(e){for(var t=1;t