mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-09 20:26:16 -08:00
2 lines
42 KiB
JavaScript
2 lines
42 KiB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.artplayer={})}(this,function(t){"use strict";function e(t,e){return t(e={exports:{}},e.exports),e.exports}var r=e(function(n){function i(t,e){return n.exports=i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},i(t,e)}n.exports=i}),o=e(function(i){function o(t,e,n){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}}()?i.exports=o=function(t,e,n){var i=[null];i.push.apply(i,e);var o=new(Function.bind.apply(t,i));return n&&r(o,n.prototype),o}:i.exports=o=Reflect.construct,o.apply(null,arguments)}i.exports=o});var n=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}};var i=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)};var a=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")};var u=function(t){return n(t)||i(t)||a()};var s=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function l(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}var c=function(t,e,n){return e&&l(t.prototype,e),n&&l(t,n),t},h=e(function(e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?e.exports=i=function(t){return n(t)}:e.exports=i=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":n(t)},i(t)}e.exports=i});var d=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t};var f=function(t,e){return!e||"object"!==h(e)&&"function"!=typeof e?d(t):e},p=e(function(e){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},n(t)}e.exports=n});var v=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&r(t,e)};var y=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};var m=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),i.forEach(function(t){y(e,t,n[t])})}return e};var g=function(t){return-1!==Function.toString.call(t).indexOf("[native code]")},k=function(t){function i(t,e){var n;return s(this,i),n=f(this,p(i).call(this,t)),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(d(d(n)),e||n.constructor),n.name="ArtPlayerError",n}return v(i,t),i}(e(function(e){function i(t){var n="function"==typeof Map?new Map:void 0;return e.exports=i=function(t){if(null===t||!g(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,e)}function e(){return o(t,arguments,p(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r(e,t)},i(t)}e.exports=i})(Error));function b(t,e){var n="function"==typeof t;if(n?!n():!t)throw new k(e)}function $(t,e,n){return Math.max(Math.min(t,Math.max(e,n)),Math.min(e,n))}function w(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",e),t.lastElementChild}function x(e,n){return Object.keys(n).forEach(function(t){e.style[t]=n[t]}),e}function T(t){var e=Math.floor(t/3600),n=Math.floor((t-3600*e)/60),i=Math.floor(t-3600*e-60*n);return(0<e?[e,n,i]:[n,i]).map(function(t){return t<10?"0".concat(t):String(t)}).join(":")}function E(t){var e=JSON.parse(localStorage.getItem("artplayer_settings"))||{};return t?e[t]:e}function S(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase().replace(/\s/g,"")}function C(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"up";t.setAttribute("data-balloon",e),t.setAttribute("data-balloon-pos",n)}var L={mimeCodec:{mp4:'video/mp4; codecs="avc1.42E01E, mp4a.40.2"',webm:'video/webm; codecs="vorbis, vp8"',ts:'video/mp2t; codecs="avc1.42E01E, mp4a.40.2"'},mse:{mediaSource:{propertys:["activeSourceBuffers","duration","readyState","sourceBuffers"],methods:["addSourceBuffer","endOfStream","removeSourceBuffer","clearLiveSeekableRange","setLiveSeekableRange"],events:["sourceclose","sourceended","sourceopen"]},sourceBuffer:{propertys:["mode","updating","buffered","timestampOffset","audioTracks","videoTracks","textTracks","appendWindowStart","appendWindowEnd","trackDefaults"],methods:["appendBuffer","appendStream","abort","remove"],events:["abort","error","update","updateend","updatestart"]},sourceBufferList:{propertys:["length"],events:["addsourcebuffer","removesourcebuffer"]}},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"]}};function P(){}P.prototype={on:function(t,e,n){var i=this.e||(this.e={});return(i[t]||(i[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){var i=this;function o(){i.off(t,o),e.apply(n,arguments)}return o._=e,this.on(t,o,n)},emit:function(t){for(var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),i=0,o=n.length;i<o;i++)n[i].fn.apply(n[i].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),i=n[t],o=[];if(i&&e)for(var r=0,a=i.length;r<a;r++)i[r].fn!==e&&i[r].fn._!==e&&o.push(i[r]);return o.length?n[t]=o:delete n[t],this}};var M=P,A=function(){function e(t){s(this,e),this.art=t,this.init()}return c(e,[{key:"init",value:function(){var t=this.art.refs;t.$container.innerHTML='\n <div class="artplayer-video-player">\n <video class="artplayer-video"></video>\n <div class="artplayer-subtitle"></div>\n <div class="artplayer-layers"></div>\n <div class="artplayer-mask"></div>\n <div class="artplayer-bottom">\n <div class="artplayer-progress"></div>\n <div class="artplayer-controls">\n <div class="artplayer-controls-left"></div>\n <div class="artplayer-controls-right"></div>\n </div>\n </div>\n <div class="artplayer-loading"></div>\n <div class="artplayer-notice"></div>\n <div class="artplayer-info">\n <div class="artplayer-info-panel"></div>\n <div class="artplayer-info-close">[x]</div>\n </div>\n </div>\n ',t.$player=t.$container.querySelector(".artplayer-video-player"),t.$video=t.$container.querySelector(".artplayer-video"),t.$subtitle=t.$container.querySelector(".artplayer-subtitle"),t.$bottom=t.$container.querySelector(".artplayer-bottom"),t.$progress=t.$container.querySelector(".artplayer-progress"),t.$controls=t.$container.querySelector(".artplayer-controls"),t.$controlsLeft=t.$container.querySelector(".artplayer-controls-left"),t.$controlsRight=t.$container.querySelector(".artplayer-controls-right"),t.$layers=t.$container.querySelector(".artplayer-layers"),t.$loading=t.$container.querySelector(".artplayer-loading"),t.$notice=t.$container.querySelector(".artplayer-notice"),t.$mask=t.$container.querySelector(".artplayer-mask"),t.$info=t.$container.querySelector(".artplayer-info"),t.$infoPanel=t.$container.querySelector(".artplayer-info-panel"),t.$infoClose=t.$container.querySelector(".artplayer-info-close")}}]),e}(),O={"zh-cn":{"About author":"关于作者","Video info":"视频统计信息",Close:"关闭","Video load failed":"视频加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音"},"zh-tw":{"About author":"關於作者","Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音"}},H=function(){function n(t){var e=t.option;s(this,n),this.option=e,this.init()}return c(n,[{key:"init",value:function(){this.language=O[this.option.lang.toLowerCase()]||{}}},{key:"get",value:function(t){return this.language[t]||t}},{key:"update",value:function(t){O=t(O),this.init()}}]),n}(),j=function(){function e(t){s(this,e),this.art=t,this.init(),this.eventBind(),this.firstLoad=!1}return c(e,[{key:"init",value:function(){var t=this.art,n=t.option,i=t.refs.$video;Object.keys(n.moreVideoAttr).forEach(function(t){var e=n.moreVideoAttr[t];i[t]=e}),i.volume=$(n.volume,0,1),i.poster=n.poster,i.autoplay=n.autoplay,i.src=n.url}},{key:"eventBind",value:function(){var e=this,t=this.art,n=t.events.proxy,i=t.refs,o=i.$player,r=i.$video,a=t.i18n,s=t.notice;L.video.events.forEach(function(t){n(r,t,function(t){e.art.emit("video:".concat(t.type),t)})}),this.art.on("video:loadstart",function(){e.art.loading.show()}),this.art.on("video:loadeddata",function(){e.art.loading.hide()}),this.art.on("video:waiting",function(){e.art.loading.show()}),this.art.on("video:seeking",function(){e.art.loading.show()}),this.art.on("video:canplay",function(){if(e.firstLoad||(e.firstLoad=!0,e.art.emit("video:firstload")),e.art.controls.show(),e.art.mask.show(),e.art.loading.hide(),e.art.option.autoplay){var t=e.play();void 0!==t&&t.then().catch(function(t){console.warn(t)})}}),this.art.on("video:playing",function(){e.art.isPlaying=!0,e.art.controls.hide(),e.art.mask.hide()}),this.art.on("video:pause",function(){e.art.isPlaying=!1,e.art.controls.show(),e.art.mask.show()}),this.art.on("video:ended",function(){e.art.isPlaying=!1,e.art.controls.show(),e.art.mask.show(),e.art.option.loop&&(e.seek(0),e.play())}),this.art.on("video:error",function(){e.art.isError=!0,e.art.isPlaying=!1,e.art.loading.hide(),e.art.controls.hide(),o.classList.add("artplayer-error"),s.show(a.get("Video load failed"),!1),e.art.destroy()})}},{key:"play",value:function(){var t=this.art,e=t.refs.$video,n=t.i18n,i=t.notice,o=e.play();return i.show(n.get("Play")),this.art.emit("play",e),o}},{key:"pause",value:function(){var t=this.art,e=t.refs.$video,n=t.i18n,i=t.notice;e.pause(),i.show(n.get("Pause")),this.art.emit("pause",e)}},{key:"toggle",value:function(){this.art.isPlaying?this.pause():this.play()}},{key:"seek",value:function(t){var e=this.art,n=e.refs.$video,i=e.notice,o=Math.max(t,0);n.duration&&(o=Math.min(o,n.duration)),n.currentTime=o,i.show("".concat(T(o)," / ").concat(T(n.duration))),this.art.emit("seek",o)}},{key:"volume",value:function(t){var e,n,i,o=this.art,r=o.refs.$video,a=o.i18n,s=o.notice;return void 0!==t&&(r.volume=$(t,0,1),s.show("".concat(a.get("Volume"),": ").concat(parseInt(100*r.volume))),0!==r.volume&&(e="volume",n=r.volume,i=Object.assign({},E(),y({},e,n)),localStorage.setItem("artplayer_settings",JSON.stringify(i))),this.art.emit("volume",r.volume)),r.volume||0}},{key:"currentTime",value:function(){return this.art.refs.$video.currentTime||0}},{key:"duration",value:function(){return this.art.refs.$video.duration||0}},{key:"playbackRate",value:function(t){var e=this.art,n=e.refs.$video,i=e.i18n,o=e.notice,r=$(t,.1,10);n.playbackRate=r,o.show("".concat(i.get("Rate"),": ").concat(r,"x")),this.art.emit("playbackRate",r)}}]),e}(),V=function(){function e(t){s(this,e),this.option=t}return c(e,[{key:"apply",value:function(t){this.art=t}}]),e}(),R=function(){function e(t){s(this,e),this.option=t}return c(e,[{key:"apply",value:function(t){this.art=t}}]),e}(),q=function(){function e(t){s(this,e),this.option=t}return c(e,[{key:"apply",value:function(t){this.art=t}}]),e}();var B=function(t){if(Array.isArray(t))return t};var D=function(t,e){var n=[],i=!0,o=!1,r=void 0;try{for(var a,s=t[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);i=!0);}catch(t){o=!0,r=t}finally{try{i||null==s.return||s.return()}finally{if(o)throw r}}return n};var N=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")};var z=function(t,e){return B(t)||D(t,e)||N()};var F,W,_=(F={loading:'<svg class="lds-spinner" width="80px" height="80px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" style="background: none;"><g transform="rotate(0 50 50)">\n <rect x="47" y="24" rx="9.4" ry="4.8" width="6" height="12" fill="#ffffff">\n <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.9166666666666666s" repeatCount="indefinite"></animate>\n </rect>\n</g><g transform="rotate(30 50 50)">\n <rect x="47" y="24" rx="9.4" ry="4.8" width="6" height="12" fill="#ffffff">\n <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.8333333333333334s" repeatCount="indefinite"></animate>\n </rect>\n</g><g transform="rotate(60 50 50)">\n <rect x="47" y="24" rx="9.4" ry="4.8" width="6" height="12" fill="#ffffff">\n <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.75s" repeatCount="indefinite"></animate>\n </rect>\n</g><g transform="rotate(90 50 50)">\n <rect x="47" y="24" rx="9.4" ry="4.8" width="6" height="12" fill="#ffffff">\n <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.6666666666666666s" repeatCount="indefinite"></animate>\n </rect>\n</g><g transform="rotate(120 50 50)">\n <rect x="47" y="24" rx="9.4" ry="4.8" width="6" height="12" fill="#ffffff">\n <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.5833333333333334s" repeatCount="indefinite"></animate>\n </rect>\n</g><g transform="rotate(150 50 50)">\n <rect x="47" y="24" rx="9.4" ry="4.8" width="6" height="12" fill="#ffffff">\n <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.5s" repeatCount="indefinite"></animate>\n </rect>\n</g><g transform="rotate(180 50 50)">\n <rect x="47" y="24" rx="9.4" ry="4.8" width="6" height="12" fill="#ffffff">\n <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.4166666666666667s" repeatCount="indefinite"></animate>\n </rect>\n</g><g transform="rotate(210 50 50)">\n <rect x="47" y="24" rx="9.4" ry="4.8" width="6" height="12" fill="#ffffff">\n <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.3333333333333333s" repeatCount="indefinite"></animate>\n </rect>\n</g><g transform="rotate(240 50 50)">\n <rect x="47" y="24" rx="9.4" ry="4.8" width="6" height="12" fill="#ffffff">\n <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.25s" repeatCount="indefinite"></animate>\n </rect>\n</g><g transform="rotate(270 50 50)">\n <rect x="47" y="24" rx="9.4" ry="4.8" width="6" height="12" fill="#ffffff">\n <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.16666666666666666s" repeatCount="indefinite"></animate>\n </rect>\n</g><g transform="rotate(300 50 50)">\n <rect x="47" y="24" rx="9.4" ry="4.8" width="6" height="12" fill="#ffffff">\n <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.08333333333333333s" repeatCount="indefinite"></animate>\n </rect>\n</g><g transform="rotate(330 50 50)">\n <rect x="47" y="24" rx="9.4" ry="4.8" width="6" height="12" fill="#ffffff">\n <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="0s" repeatCount="indefinite"></animate>\n </rect>\n</g></svg>\n',playBig:'<svg style="width: 60px; height: 60px; filter: drop-shadow(0px 1px 1px black);" version="1.1" viewBox="0 0 24 24" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <g id="info"/>\n <g id="icons">\n <path d="M20,2H4C1.8,2,0,3.8,0,6v12c0,2.2,1.8,4,4,4h16c2.2,0,4-1.8,4-4V6C24,3.8,22.2,2,20,2z M15.6,12.8L10.5,16 C9.9,16.5,9,16,9,15.2V8.8C9,8,9.9,7.5,10.5,8l5.1,3.2C16.3,11.5,16.3,12.5,15.6,12.8z" id="video"/>\n </g>\n</svg>',play:'<svg xmlns="http://www.w3.org/2000/svg" style="width: 100%; height: 100%" viewBox="0 0 22 22">\n <path d="M17.982 9.275L8.06 3.27A2.013 2.013 0 0 0 5 4.994v12.011a2.017 2.017 0 0 0 3.06 1.725l9.922-6.005a2.017 2.017 0 0 0 0-3.45z"></path>\n</svg>',pause:'<svg xmlns="http://www.w3.org/2000/svg" style="width: 100%; height: 100%" viewBox="0 0 22 22">\n <path d="M7 3a2 2 0 0 0-2 2v12a2 2 0 1 0 4 0V5a2 2 0 0 0-2-2zM15 3a2 2 0 0 0-2 2v12a2 2 0 1 0 4 0V5a2 2 0 0 0-2-2z"></path>\n</svg>',volume:'<svg xmlns="http://www.w3.org/2000/svg" style="width: 100%; height: 100%" viewBox="0 0 22 22">\n <path d="M10.188 4.65L6 8H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h1l4.188 3.35a.5.5 0 0 0 .812-.39V5.04a.498.498 0 0 0-.812-.39zM14.446 3.778a1 1 0 0 0-.862 1.804 6.002 6.002 0 0 1-.007 10.838 1 1 0 0 0 .86 1.806A8.001 8.001 0 0 0 19 11a8.001 8.001 0 0 0-4.554-7.222z"></path><path d="M15 11a3.998 3.998 0 0 0-2-3.465v6.93A3.998 3.998 0 0 0 15 11z"></path>\n</svg>',volumeClose:'<svg xmlns="http://www.w3.org/2000/svg" style="width: 100%; height: 100%" viewBox="0 0 22 22">\n <path d="M15 11a3.998 3.998 0 0 0-2-3.465v2.636l1.865 1.865A4.02 4.02 0 0 0 15 11z"></path>\n <path d="M13.583 5.583A5.998 5.998 0 0 1 17 11a6 6 0 0 1-.585 2.587l1.477 1.477a8.001 8.001 0 0 0-3.446-11.286 1 1 0 0 0-.863 1.805zM18.778 18.778l-2.121-2.121-1.414-1.414-1.415-1.415L13 13l-2-2-3.889-3.889-3.889-3.889a.999.999 0 1 0-1.414 1.414L5.172 8H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h1l4.188 3.35a.5.5 0 0 0 .812-.39v-3.131l2.587 2.587-.01.005a1 1 0 0 0 .86 1.806c.215-.102.424-.214.627-.333l2.3 2.3a1.001 1.001 0 0 0 1.414-1.416zM11 5.04a.5.5 0 0 0-.813-.39L8.682 5.854 11 8.172V5.04z"></path>\n</svg>'},W={},Object.keys(F).forEach(function(t){var e=document.createElement("div");e.innerHTML='<i class="art-icon art-icon-'.concat(t,'">').concat(F[t],"</i>");var n=z(e.childNodes,1);W[t]=n[0]}),W),I=function(){function e(t){s(this,e),this.option=t}return c(e,[{key:"apply",value:function(t){this.art=t,this.init()}},{key:"init",value:function(){var t=this,e=this.art,n=e.events.proxy,i=e.player,o=e.i18n;this.$play=w(this.option.$control,_.play),this.$pause=w(this.option.$control,_.pause),C(this.$play,o.get("Play")),C(this.$pause,o.get("Pause")),this.$pause.style.display="none",n(this.$play,"click",function(){i.play()}),n(this.$pause,"click",function(){i.pause()}),this.art.on("video:playing",function(){t.$play.style.display="none",t.$pause.style.display="block"}),this.art.on("video:pause",function(){t.$play.style.display="block",t.$pause.style.display="none"})}}]),e}(),U=function(){function e(t){s(this,e),this.option=t}return c(e,[{key:"apply",value:function(t){this.art=t,this.isDroging=!1,this.getLoaded=this.getLoaded.bind(this),this.getPlayed=this.getPlayed.bind(this),this.set=this.set.bind(this),this.init()}},{key:"init",value:function(){var o=this,t=this.art,e=t.option,n=e.highlight,i=e.theme,r=t.events.proxy,a=t.refs.$video,s=t.player;w(this.option.$control,'\n <div class="art-control-progress-inner">\n <div class="art-progress-loaded"></div>\n <div class="art-progress-played" style="background: '.concat(i,'"></div>\n <div class="art-progress-highlight"></div>\n <div class="art-progress-indicator" style="background: ').concat(i,'"></div>\n <div class="art-progress-tip art-tip"></div>\n </div>\n ')),this.$loaded=this.option.$control.querySelector(".art-progress-loaded"),this.$played=this.option.$control.querySelector(".art-progress-played"),this.$highlight=this.option.$control.querySelector(".art-progress-highlight"),this.$indicator=this.option.$control.querySelector(".art-progress-indicator"),this.$tip=this.option.$control.querySelector(".art-progress-tip"),this.set("loaded",this.getLoaded()),n.forEach(function(t){var e=Number(t.time)/a.duration;w(o.$highlight,'\n <span data-text="'.concat(t.text,'" data-time="').concat(t.time,'" style="left: ').concat(100*e,'%"></span>\n '))}),this.art.on("video:progress",function(){o.set("loaded",o.getLoaded())}),this.art.on("video:timeupdate",function(){o.set("played",o.getPlayed())}),this.art.on("video:ended",function(){o.set("played",1)}),r(this.option.$control,"mousemove",function(t){o.$tip.style.display="block",-1<t.path.indexOf(o.$highlight)?o.showHighlight(t):o.showTime(t)}),r(this.option.$control,"mouseout",function(){o.$tip.style.display="none"}),r(this.option.$control,"click",function(t){if(t.target!==o.$indicator){var e=o.getPosFromEvent(t),n=e.second,i=e.percentage;o.set("played",i),s.seek(n)}}),r(this.$indicator,"mousedown",function(){o.isDroging=!0}),r(document,"mousemove",function(t){if(o.isDroging){var e=o.getPosFromEvent(t),n=e.second,i=e.percentage;o.$indicator.classList.add("show-indicator"),o.set("played",i),s.seek(n)}}),r(document,"mouseup",function(){o.isDroging&&(o.isDroging=!1,o.$indicator.classList.remove("show-indicator"))})}},{key:"showHighlight",value:function(t){var e=this.art.refs.$video,n=t.target.dataset,i=n.text,o=n.time;this.$tip.innerHTML=i;var r=Number(o)/e.duration*this.option.$control.clientWidth+t.target.clientWidth/2-this.$tip.clientWidth/2;this.$tip.style.left="".concat(r,"px")}},{key:"showTime",value:function(t){var e=this.getPosFromEvent(t),n=e.width,i=e.time,o=this.$tip.clientWidth;this.$tip.innerHTML=i,n<=o/2?this.$tip.style.left=0:n>this.option.$control.clientWidth-o/2?this.$tip.style.left="".concat(this.option.$control.clientWidth-o,"px"):this.$tip.style.left="".concat(n-o/2,"px")}},{key:"getPlayed",value:function(){var t=this.art.refs.$video;return t.currentTime/t.duration}},{key:"getLoaded",value:function(){var t=this.art.refs.$video;return t.buffered.length?t.buffered.end(t.buffered.length-1)/t.duration:0}},{key:"getPosFromEvent",value:function(t){var e=this.art.refs,n=e.$video,i=e.$progress,o=i.getBoundingClientRect().left,r=$(t.x-o,0,i.clientWidth),a=r/i.clientWidth*n.duration;return{second:a,time:T(a),width:r,percentage:$(r/i.clientWidth,0,1)}}},{key:"set",value:function(t,e){this["$".concat(t)].style.width="".concat(100*e,"%"),"played"===t&&(this.$indicator.style.left="calc(".concat(100*e,"% - 6.5px)"))}}]),e}(),Y=function(){function e(t){s(this,e),this.option=t}return c(e,[{key:"apply",value:function(t){this.art=t}}]),e}(),J=function(){function e(t){s(this,e),this.option=t}return c(e,[{key:"apply",value:function(t){this.art=t,this.init()}},{key:"init",value:function(){var t=this;this.option.$control.innerHTML="00:00 / 00:00",this.art.on("video:canplay",function(){t.option.$control.innerHTML=t.getTime()}),this.art.on("video:timeupdate",function(){t.option.$control.innerHTML=t.getTime()}),this.art.on("video:seeking",function(){t.option.$control.innerHTML=t.getTime()})}},{key:"getTime",value:function(){var t=this.art.player;return"".concat(T(t.currentTime())," / ").concat(T(t.duration()))}}]),e}(),X=function(){function e(t){s(this,e),this.option=t}return c(e,[{key:"apply",value:function(t){this.art=t,this.isDroging=!1,this.init()}},{key:"init",value:function(){var e=this,t=this.art,n=t.events.proxy,i=t.player,o=t.i18n;this.$volume=w(this.option.$control,_.volume),this.$volumeClose=w(this.option.$control,_.volumeClose),this.$volumePanel=w(this.option.$control,'<div class="art-volume-panel"></div>'),this.$volumeHandle=w(this.$volumePanel,'<div class="art-volume-slider-handle"></div>'),C(this.$volume,o.get("Mute")),this.$volumeClose.style.display="none";var r=E("volume");this.setVolumeHandle(r),i.volume(r),n(this.$volume,"click",function(){e.$volume.style.display="none",e.$volumeClose.style.display="block",i.volume(0)}),n(this.$volumeClose,"click",function(){e.$volume.style.display="block",e.$volumeClose.style.display="none",i.volume(E("volume"))}),n(this.option.$control,"mouseenter",function(){e.$volumePanel.classList.add("art-volume-panel-hover"),setTimeout(function(){e.setVolumeHandle(i.volume())},200)}),n(this.option.$control,"mouseleave",function(){e.$volumePanel.classList.remove("art-volume-panel-hover")}),n(this.$volumePanel,"click",function(t){e.volumeChangeFromEvent(t)}),n(this.$volumeHandle,"mousedown",function(){e.isDroging=!0}),n(this.$volumeHandle,"mousemove",function(t){e.isDroging&&e.volumeChangeFromEvent(t)}),n(document,"mouseup",function(){e.isDroging&&(e.isDroging=!1)}),this.art.on("video:volumechange",function(){var t=i.volume();e.setVolumeHandle(t),e.$volumeClose.style.display=0===t?(e.$volume.style.display="none","block"):(e.$volume.style.display="block","none")})}},{key:"volumeChangeFromEvent",value:function(t){var e=this.art.player,n=this.$volumePanel.getBoundingClientRect(),i=n.left,o=n.width,r=this.$volumeHandle.getBoundingClientRect().width,a=$(t.x-i-r/2,0,o-r/2)/(o-r);e.volume(a)}},{key:"setVolumeHandle",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:.7,e=this.$volumePanel.getBoundingClientRect().width,n=this.$volumeHandle.getBoundingClientRect().width,i=n/2+(e-n)*t-n/2;this.$volumeHandle.style.left="".concat(i,"px")}}]),e}(),G=function(){function e(t){s(this,e),this.option=t}return c(e,[{key:"apply",value:function(t){this.art=t}}]),e}(),K=function(){function e(t){s(this,e),this.option=t,this.loading=!1,this.isLoad=!1}return c(e,[{key:"apply",value:function(t){this.art=t,this.init()}},{key:"init",value:function(){var e=this,t=this.art,n=t.refs.$progress,i=t.events.proxy;i(n,"mousemove",function(t){e.loading||(e.loading=!0,e.load(e.art.option.thumbnails.url).then(function(){e.isLoad=!0})),e.isLoad&&(e.option.$control.style.display="block",e.showThumbnails(t))}),i(n,"mouseout",function(){e.option.$control.style.display="none"})}},{key:"load",value:function(i){var o=this.art.events.proxy;return new Promise(function(t,e){var n=new Image;if(n.src=i,n.complete)return t(n);o(n,"load",function(){return t(n)}),o(n,"error",function(){return e(n)})})}},{key:"showThumbnails",value:function(t){var e=this.art,n=e.refs.$progress,i=e.controls.progress.getPosFromEvent(t).width,o=this.art.option.thumbnails,r=o.url,a=o.height,s=o.width,l=o.number,c=o.column,u=n.clientWidth/l,h=Math.ceil(i/u),d=Math.ceil(h/c),f=h%c||c;this.option.$control.style.backgroundImage="url(".concat(r,")"),this.option.$control.style.height="".concat(a,"px"),this.option.$control.style.width="".concat(s,"px"),this.option.$control.style.backgroundPosition="-".concat(--f*s,"px -").concat(--d*a,"px"),i<=s/2?this.option.$control.style.left=0:i>n.clientWidth-s/2?this.option.$control.style.left="".concat(n.clientWidth-s,"px"):this.option.$control.style.left="".concat(i-s/2,"px")}}]),e}(),Q=0,Z=function(){function n(t){var e=this;s(this,n),this.art=t,this.$map={},this.art.on("video:firstload",function(){e.init(),e.mount()})}return c(n,[{key:"init",value:function(){var e=this;this.add(new U({disable:!1,position:"top",index:10})),this.add(new K({disable:!this.art.option.thumbnails.url,position:"top",index:20})),this.add(new I({disable:!1,position:"left",index:10})),this.add(new X({disable:!1,position:"left",index:20})),this.add(new J({disable:!1,position:"left",index:30})),this.add(new V({disable:!1,position:"right",index:10})),this.add(new Y({disable:!1,position:"right",index:20})),this.add(new G({disable:!1,position:"right",index:30})),this.add(new q({disable:!1,position:"right",index:40})),this.add(new R({disable:!1,position:"right",index:50})),this.art.option.controls.forEach(function(t){e.add(t)})}},{key:"add",value:function(t){var e=t.option;if(e&&!e.disable){Q++;var n=t.constructor.name.toLowerCase()||"control".concat(Q),i=document.createElement("div");i.setAttribute("class","art-control art-control-".concat(n)),i.setAttribute("data-control-index",String(e.index)||Q),e.$control=i,this.commonMethod(t),(this.$map[e.position]||(this.$map[e.position]=[])).push(i),t.apply&&t.apply(this.art),this[n]=t}}},{key:"mount",value:function(){var t=this,e=this.art.refs,n=e.$progress,i=e.$controlsLeft,o=e.$controlsRight;Object.keys(this.$map).forEach(function(e){t.$map[e].sort(function(t,e){return Number(t.dataset.controlIndex)-Number(e.dataset.controlIndex)}).forEach(function(t){switch(e){case"top":n.appendChild(t);break;case"left":i.appendChild(t);break;case"right":o.appendChild(t)}})})}},{key:"commonMethod",value:function(t){var e=this;Object.defineProperty(t,"hide",{value:function(){t.option.$control.style.display="none",e.art.emit("control:hide",t.option.$control)}}),Object.defineProperty(t,"show",{value:function(){t.option.$control.style.display="block",e.art.emit("control:show",t.option.$control)}})}},{key:"show",value:function(){this.art.refs.$player.classList.add("controls-show")}},{key:"hide",value:function(){this.art.refs.$player.classList.remove("controls-show")}}]),n}(),tt=0,et=function(){function e(t){s(this,e),this.art=t,this.init()}return c(e,[{key:"init",value:function(){var e=this,t=this.art,n=t.option,i=t.i18n,o=t.refs,r=t.events.proxy;n.contextmenu.push({name:"info",html:i.get("Video info"),click:function(){e.art.info.show()}},{name:"version",html:'<a href="https://github.com/zhw2590582/artplayer" target="_blank">ArtPlayer 1.0.0</a>'},{name:"close",html:i.get("Close"),click:function(){e.hide()}}),r(o.$player,"contextmenu",function(t){t.preventDefault(),e.art.isFocus=!0,o.$contextmenu||e.creatMenu(),e.show(),e.setPos(t)}),r(o.$player,"click",function(t){o.$contextmenu&&!t.path.includes(o.$contextmenu)&&e.hide()})}},{key:"creatMenu",value:function(){var i=this,t=this.art,e=t.option,o=t.refs,r=t.events.proxy;o.$contextmenu=document.createElement("div"),o.$contextmenu.classList.add("artplayer-contextmenu"),e.contextmenu.forEach(function(e){tt++;var n=document.createElement("div");n.setAttribute("data-art-menu-id",tt),n.setAttribute("class","art-menu art-menu-".concat(e.name||tt)),w(n,e.html),x(n,e.style||{}),e.click&&r(n,"click",function(t){t.preventDefault(),e.click(i.art,t),i.hide(),i.art.emit("contextmenu:click",n)}),w(o.$contextmenu,n)}),w(o.$player,o.$contextmenu)}},{key:"setPos",value:function(t){var e=this.art.refs,n=t.clientX,i=t.clientY,o=e.$player.getBoundingClientRect(),r=o.height,a=o.width,s=o.left,l=o.top,c=e.$contextmenu.getBoundingClientRect(),u=c.height,h=c.width,d=n-s,f=i-l;s+a<n+h&&(d=a-h),l+r<i+u&&(f=r-u),e.$contextmenu.style.left="".concat(d,"px"),e.$contextmenu.style.top="".concat(f,"px")}},{key:"hide",value:function(){var t=this.art.refs.$contextmenu;t&&(t.style.display="none",this.art.emit("contextmenu:hide",t))}},{key:"show",value:function(){var t=this.art.refs.$contextmenu;t&&(t.style.display="block",this.art.emit("contextmenu:show",t))}}]),e}(),nt=function t(e){s(this,t),this.art=e},it=function(){function e(t){s(this,e),this.art=t,this.init()}return c(e,[{key:"init",value:function(){var t=this,e=this.art,n=e.refs.$infoClose;(0,e.events.proxy)(n,"click",function(){t.hide()})}},{key:"show",value:function(){var t=this.art.refs,e=t.$info,n=t.$infoPanel;e.style.display="block",n.innerHTML||(w(n,this.creatInfo()),this.getHeader()),clearTimeout(this.timer),this.loop(),this.art.emit("info:show",e)}},{key:"creatInfo",value:function(){var t=[];return t.push('\n <div class="art-info-item ">\n <div class="art-info-title">Player version:</div>\n <div class="art-info-content">1.0.0</div>\n </div>\n '),t.push('\n <div class="art-info-item">\n <div class="art-info-title">Video url:</div>\n <div class="art-info-content" data-video="currentSrc"></div>\n </div>\n '),t.push('\n <div class="art-info-item">\n <div class="art-info-title">Video type:</div>\n <div class="art-info-content" data-head="Content-Type">loading...</div>\n </div>\n '),t.push('\n <div class="art-info-item">\n <div class="art-info-title">Video size:</div>\n <div class="art-info-content" data-head="Content-length">loading...</div>\n </div>\n '),t.push('\n <div class="art-info-item">\n <div class="art-info-title">Video volume:</div>\n <div class="art-info-content" data-video="volume"></div>\n </div>\n '),t.push('\n <div class="art-info-item">\n <div class="art-info-title">Video time:</div>\n <div class="art-info-content" data-video="currentTime"></div>\n </div>\n '),t.push('\n <div class="art-info-item">\n <div class="art-info-title">Video duration:</div>\n <div class="art-info-content" data-video="duration"></div>\n </div>\n '),t.push('\n <div class="art-info-item">\n <div class="art-info-title">Video resolution:</div>\n <div class="art-info-content">\n <span data-video="videoWidth"></span> x <span data-video="videoHeight"></span>\n </div>\n </div>\n '),t.join("")}},{key:"getHeader",value:function(){var t=this.art,e=t.option.url,n=t.refs.$infoPanel,i=Array.from(n.querySelectorAll("[data-head]"));fetch(e,{method:"HEAD"}).then(function(n){i.forEach(function(t){var e=n.headers.get(t.dataset.head);t.innerHTML=void 0!==e?e:"unknown"})}).catch(function(){i.forEach(function(t){t.innerHTML="unknown"})})}},{key:"loop",value:function(){var t=this,e=this.art.refs,n=e.$infoPanel,i=e.$video;this.timer=setTimeout(function(){Array.from(n.querySelectorAll("[data-video]")).forEach(function(t){var e=i[t.dataset.video];t.innerHTML=void 0!==e?e:"unknown"}),t.loop()},1e3)}},{key:"hide",value:function(){var t=this.art.refs.$info;t.style.display="none",clearTimeout(this.timer),this.art.emit("info:hide",t)}}]),e}(),ot=function(){function n(t){s(this,n),this.art=t;var e=this.art.option.subtitle.url;e&&(this.checkExt(e),this.init())}return c(n,[{key:"init",value:function(){var i=this,t=this.art,e=t.events.proxy,n=t.option.subtitle,o=t.refs,r=o.$video,a=o.$subtitle;x(a,n.style||{});var s=document.createElement("track");s.default=!0,s.kind="metadata",this.load(n.url).then(function(t){if(s.src=t,r.appendChild(s),i.art.refs.$track=s,r.textTracks&&r.textTracks[0]){var n=z(r.textTracks,1)[0];e(n,"cuechange",function(){var t=z(n.activeCues,1)[0];if(a.innerHTML="",t){var e=document.createElement("div");e.appendChild(t.getCueAsHTML()),a.innerHTML=e.innerHTML.split(/\r?\n/).map(function(t){return"<p>".concat(t,"</p>")}).join("")}i.art.emit("subtitle:update",a)})}})}},{key:"load",value:function(e){var n,i=this;return fetch(e).then(function(t){return n=t.headers.get("Content-Type"),t.text()}).then(function(t){return/x-subrip/gi.test(n)?i.srtToVtt(t):e}).catch(function(t){throw t})}},{key:"srtToVtt",value:function(t){var e="WEBVTT \r\n\r\n".concat(t.replace(/\{\\([ibu])\}/g,"</$1>").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"));return URL.createObjectURL(new Blob([e],{type:"text/vtt"}))}},{key:"checkExt",value:function(t){var e=function t(e){return e.includes("?")?t(e.split("?")[0]):e.includes("#")?t(e.split("#")[0]):e.trim().toLowerCase().split(".").pop()}(t);b("vtt"===e||"srt"===e,"'subtitle.url' option require 'vtt' or 'srt' format, but got '".concat(e,"'."))}},{key:"show",value:function(){var t=this.art.refs.$subtitle;t.style.display="block",this.art.emit("subtitle:show",t)}},{key:"hide",value:function(){var t=this.art.refs.$subtitle;t.style.display="none",this.art.emit("subtitle:hide",t)}},{key:"switch",value:function(e){var n=this,i=this.art.refs.$track;this.checkExt(e),b(i,"You need to initialize the subtitle option first."),this.load(e).then(function(t){e!==t&&(i.src=t,n.art.emit("subtitle:switch",e))})}}]),n}(),rt=function(){function e(t){s(this,e),this.art=t,this.destroyEvents=[],this.proxy=this.proxy.bind(this)}return c(e,[{key:"proxy",value:function(e,t,n){var i=this,o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{};Array.isArray(t)&&t.forEach(function(t){return i.proxy(e,t,n,o)}),e.addEventListener(t,n,o),this.destroyEvents.push(function(){e.removeEventListener(t,n,o)})}},{key:"destroy",value:function(){this.destroyEvents.forEach(function(t){return t()})}}]),e}(),at=function(){function e(t){s(this,e),this.art=t,this.art.option.hotkey&&this.init()}return c(e,[{key:"init",value:function(){var i=this,t=this.art,o=t.player,e=t.refs.$player,n=t.events.proxy;n(document,"click",function(t){i.art.isFocus=-1<t.path.indexOf(e)}),n(window,"keydown",function(t){if(i.art.isFocus){var e=document.activeElement.tagName.toUpperCase(),n=document.activeElement.getAttribute("contenteditable");if("INPUT"!==e&&"TEXTAREA"!==e&&""!==n&&"true"!==n)switch(t.keyCode){case 39:t.preventDefault(),o.seek(o.currentTime()+10);break;case 37:t.preventDefault(),o.seek(o.currentTime()-10);break;case 38:t.preventDefault(),o.volume(o.volume()+.05);break;case 40:t.preventDefault(),o.volume(o.volume()-.05);break;case 32:t.preventDefault(),o.toggle()}}})}}]),e}(),st=0,lt=function(){function e(t){s(this,e),this.art=t,this.add=this.add.bind(this),this.art.option.layers.filter(function(t){return!1===t.disable}).forEach(this.add),this.init()}return c(e,[{key:"init",value:function(){var t=this.art,e=t.refs,n=t.player;(0,t.events.proxy)(e.$layers,"click",function(t){t.path[0]===e.$layers&&n.pause()})}},{key:"add",value:function(t,e){var n=this.art.refs;st++;var i=document.createElement("div");i.setAttribute("data-art-layer-id",st),i.setAttribute("class","art-layer art-layer-".concat(t.name||st)),i.style.zIndex=t.index||st,w(i,t.html),x(i,t.style||{}),n.$layers.appendChild(i),this.art.emit("layers:add",i),e&&e(i)}},{key:"show",value:function(){var t=this.art.refs.$layers;t.style.display="block",this.art.emit("layers:show",t)}},{key:"hide",value:function(){var t=this.art.refs.$layers;t.style.display="none",this.art.emit("layers:hide",t)}}]),e}(),ct=function(){function e(t){s(this,e),this.art=t,this.init()}return c(e,[{key:"init",value:function(){var t=this.art,e=t.option;w(t.refs.$loading,e.loading||_.loading)}},{key:"hide",value:function(){var t=this.art.refs.$loading;t.style.display="none",this.art.emit("loading:hide",t)}},{key:"show",value:function(){var t=this.art.refs.$loading;t.style.display="flex",this.art.emit("loading:show",t)}}]),e}(),ut=function(){function e(t){s(this,e),this.art=t,this.timer=null}return c(e,[{key:"show",value:function(t){var e=this,n=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1e3,o=this.art.refs.$notice;o.style.display="block",o.innerHTML=t instanceof Error?t.message.trim():t,n&&(clearTimeout(this.timer),this.timer=setTimeout(function(){e.hide()},i)),this.art.emit("notice:show",o)}},{key:"hide",value:function(){var t=this.art.refs.$notice;t.style.display="none",this.art.emit("notice:hide",t)}}]),e}(),ht=function(){function e(t){s(this,e),this.art=t,this.init()}return c(e,[{key:"init",value:function(){var t=this,e=this.art,n=e.player,i=e.refs,o=e.events.proxy;w(i.$mask,_.playBig),o(i.$mask,"click",function(){n.play(),t.hide()})}},{key:"show",value:function(){var t=this.art.refs.$mask;t.style.display="block",this.art.emit("mask:show",t)}},{key:"hide",value:function(){var t=this.art.refs.$mask;t.style.display="none",this.art.emit("mask:show",t)}}]),e}(),dt=0,ft=[],pt=function(t){function n(t){var e;return s(this,n),(e=f(this,p(n).call(this))).emit("init:start"),e.option=function t(){for(var e=function(t){return null!==t&&"object"===h(t)},n={},i=arguments.length,o=new Array(i),r=0;r<i;r++)o[r]=arguments[r];for(var a=0;a<o.length;a++){var s=o[a];if(Array.isArray(s))Array.isArray(n)||(n=[]),n=u(n).concat(u(s));else if(e(s))for(var l in s)if(s.hasOwnProperty(l)){var c=s[l];e(c)&&l in n&&(c=t(n[l],c)),n=m({},n,y({},l,c))}}return n}({},n.DEFAULTS,t),function r(a,s){var l=2<arguments.length&&void 0!==arguments[2]?arguments[2]:["option"];Object.keys(a).forEach(function(n){var t=a[n],e=s[n],i=S(t),o=S(e);"container"===n||"html"===n?b("string"===o||e instanceof Element,"'".concat(l.join("."),".").concat(n,"' require 'string' or 'Element' type, but got '").concat(o,"'")):b(i===o,"'".concat(l.join("."),".").concat(n,"' require '").concat(i,"' type, but got '").concat(o,"'")),"object"===o&&r(t,e,l.concat(n)),1===l.length&&("layers"===n&&e.forEach(function(t,e){r({name:"",index:0,html:"",style:{}},t,l.concat("".concat(n,"[").concat(e,"]")))}),"contextmenu"===n&&e.forEach(function(t,e){r({name:"",click:new Function,html:"",style:{}},t,l.concat("".concat(n,"[").concat(e,"]")))}),"highlight"===n&&e.forEach(function(t,e){r({time:0,text:""},t,l.concat("".concat(n,"[").concat(e,"]")))}),"controls"===n&&e.forEach(function(t,e){t.option&&r({disable:!1,position:"",index:0},t.option,l.concat("".concat(n,"[").concat(e,"]")))}))})}(n.DEFAULTS,e.option),e.init(),e.emit("init:end"),e}return v(n,M),c(n,[{key:"init",value:function(){return this.isError=!1,this.isFocus=!1,this.isPlaying=!1,this.refs={},this.option.container instanceof Element?this.refs.$container=this.option.container:this.refs.$container=document.querySelector(this.option.container),this.template=new A(this),this.i18n=new H(this),this.notice=new ut(this),this.events=new rt(this),this.player=new j(this),this.layers=new lt(this),this.controls=new Z(this),this.contextmenu=new et(this),this.danmu=new nt(this),this.subtitle=new ot(this),this.info=new it(this),this.loading=new ct(this),this.hotkey=new at(this),this.mask=new ht(this),this.id=dt++,ft.push(this),this}},{key:"destroy",value:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0];this.events.destroy(),ft.splice(ft.indexOf(this),1),t&&(this.refs.$container.innerHTML=""),this.emit("destroy")}}],[{key:"use",value:function(t){var e=t.name.toLowerCase(),n=this.plugins||(this.plugins={});if(!n[e]){var i=Array.from(arguments).slice(1);i.unshift(this),n[e]=o(t,u(i)),this.prototype.emit("use",t)}return this}},{key:"version",get:function(){return"1.0.0"}},{key:"config",get:function(){return L}},{key:"DEFAULTS",get:function(){return{container:".artplayer",url:"",poster:"",volume:.7,thumbnails:{url:"",number:60,width:160,height:90,column:10},autoplay:!1,loop:!1,type:"",mimeCodec:"",layers:[],contextmenu:[],loading:"",theme:"#f00",hotkey:!0,subtitle:{url:"",style:{}},controls:[],highlight:[],moreVideoAttr:{controls:!1,preload:"auto","webkit-playsinline":!0,playsinline:!0},lang:navigator.language.toLowerCase()}}}]),n}();window.Artplayer=pt,t.instances=ft,t.default=pt,Object.defineProperty(t,"__esModule",{value:!0})});
|