UNPKG

ps-tcplayer

Version:

Tencent Cloud Player component with Vue2/Vue3 compatibility

28 lines (27 loc) 36.4 kB
(function(p,v){typeof exports=="object"&&typeof module<"u"?v(exports,require("vue-demi")):typeof define=="function"&&define.amd?define(["exports","vue-demi"],v):(p=typeof globalThis<"u"?globalThis:p||self,v(p.TcPlayer={},p.vueDemi))})(this,function(p,v){"use strict";function w(i,e){let t=[...i];if(!t.length)return e&&e(),console.log("resouce loaded"),!1;let s=t.shift();if(!s)return w(t,e),!1;s.endsWith(".js")?M(s,()=>{w(t,e)}):s.endsWith(".css")?I(s,()=>{w(t,e)}):(console.warn("no suport resource:",s),w(t,e))}function M(i,e){if(document.querySelector(`script[src="${i}"]`))return console.log(i,":has youle"),e&&e(),!1;var t=document.createElement("script"),s=e||function(){};t.type="text/javascript",t.readyState?t.onreadystatechange=function(){t.readyState=="loaded"||t.readyState=="complete",t.onreadystatechange=null,s(),console.log(t.readyState)}:(t.onload=function(){s()},t.onerror=function(n){s(),console.log(n)}),t.src=i,document.querySelector("body").appendChild(t)}function I(i,e){if(document.querySelector(`link[href="${i}"]`))return console.log(i,":has youle"),e&&e(),!1;var t=document.createElement("link"),s=e||function(){};t.rel="stylesheet",t.readyState?t.onreadystatechange=function(){t.readyState=="loaded"||t.readyState=="complete",t.onreadystatechange=null,s(),console.log(t.readyState)}:(t.onload=function(){s()},t.onerror=function(n){s(),console.log(n)}),t.href=i,document.querySelector("head").appendChild(t)}const x='<div class="player-olympic-player-next"><div class="player-olympic-player-next-tip">\u4E0B\u4E00\u8282</div></div>',K="",N="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA4ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDowOGJiODA5NC0xNDBlLTQ3NmUtOThjMS05YjkyNzUzZGUxZjUiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6NUE3MzdENzIzMDcwMTFFQkJBNDA4NUREMTk1NTZBMzEiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6NUE3MzdENzEzMDcwMTFFQkJBNDA4NUREMTk1NTZBMzEiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTcgKE1hY2ludG9zaCkiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo5M2YyNmFjOC0zOWVjLTQ5MjctOTI1MC01OGYyODJhOThiZGEiIHN0UmVmOmRvY3VtZW50SUQ9ImFkb2JlOmRvY2lkOnBob3Rvc2hvcDowZDlmMzQwYS03OGRhLTExN2UtODljNS05ZTJkOWEyMjNlMmYiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz68KeUaAAACVklEQVR42uyaPUgcQRiG9y5yFiYgKAGRsxKJXAySIv5U2kq0EyXptFbDFQqxEESbkEIDwUIUO0OMlYiFhYJKfgoREgVRmxBUVEgEBQXj+g474Co7K+ze7ex57wsP3N3CcDzMfDvf7EZM0zQYdaJUQEEUREEUREEUREEUxFAQBVEQBVEQBVEQBTEUlLWCHoERcAzEWfIO6AYPvA4YScGZdAGoAwdgWf4xXfkMmh1+7wd9nkYUgnxQA/6a1/kGXvgc0ytxU51dr+P6XWIfQb7texX4CsZAYcCzJ+5yrUhXDXqmGLMNbIEOkJPJ9dTvoG7FT8ysD2BV1ijexRSpAAtg8o5lkPW3+VawAd6CGAU55yEYBOuggYLUKQWzYEZ+piBFXoJfYADkUZBzckGvrE8tFKROCfgk73gJClJH7JnWwNCtXToF2SJ2311gU+7KoxTknMeyr1sBTylInWqwBIopyL23e0VB7olRkDrn4AsFOec3aJR3NQqy5Uw2t+VgXtd+I6wRjWwSbOvekIUtQkgnmGOrcTMnhnWYlgiLnDDNIHEcKx7w/Qljz6MzP+VyWgxrIdS1xP5JMc/DLEfHDLoEE6AHHGXCBixIQd/lrPmRSb1NEEvsELSD2kyTk25BF2AYlIFxubzSvXxDJ0jVG4nCWwneyIIcRNy2CHu6BCVll21vKsUT1HrDejgYdEM7rbg26nXQVLxA9QQ0GdYLVFPgVGPJEG+YvQOv5ed9wzr8fw/+6xJ0r8OXOCmIgiiIgiiIgiiIghgKoiAKoiAKoiAKoiDGlisBBgBcQ0BsCEYJ1AAAAABJRU5ErkJggg==";function f(i){let e=document.createElement("div");return e.innerHTML=i.trim(),e.childNodes[0]}function S(i,e){const t=e.parentNode;t.lastChild===e?t.appendChild(i):t.insertBefore(i,e.nextSibling)}class D{constructor(e,t){this.player=e,this.clickHandle=t,this.$html=f(x)}createEl(e){if(this.clickHandle){this.$html.onclick=()=>{console.log("this.clickHandle",this.clickHandle),typeof this.clickHandle=="function"?this.clickHandle():typeof this.clickHandle=="string"&&(window.location.href=this.clickHandle)},this.$html.style.backgroundImage=`url(${N})`;const t=e.querySelector(".vjs-play-control");S(this.$html,t)}}dispose(){this.$html.parentNode.removeChild(this.$html)}}const P='<div class="player-olympic-player-prev"><div class="player-olympic-player-prev-tip">\u4E0A\u4E00\u8282</div></div>',ee="",R="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA4RpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDplNmVjNDgwYi02N2JjLWMwNDYtYmI4NS01MTM1YjIyYzlkZGMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6NUE3MzdENkUzMDcwMTFFQkJBNDA4NUREMTk1NTZBMzEiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6NUE3MzdENkQzMDcwMTFFQkJBNDA4NUREMTk1NTZBMzEiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTcgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6YmZiYTcwMTAtN2VkYi00MjQ4LTllNDgtZTY1YzEzNWE0ZTJjIiBzdFJlZjpkb2N1bWVudElEPSJhZG9iZTpkb2NpZDpwaG90b3Nob3A6NTcyMDAwOGItNzhkYS0xMTdlLTg5YzUtOWUyZDlhMjIzZTJmIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+87YrpwAAAk9JREFUeNrsmj9IG1EAhy/a6qAUhyKCqEtFigq2g7SaQVdBh4JU2qXorDiEaksRHErBqf4Bh9COugiCQRwcDLiEughSsBpBRCSIolgRlTTp73FvCOWehrty7134ffAtAR/nl3vv7l0ulM1mLaImxEAMxEAMxEAMxEAMxECEgRiIgRiIgRiIgRiIMFDeFHn8+2L4Hu5BUToFZ+EjnkE243DM4fNF+Ern/wXDsBLG4anrkUQgDx5l1dR5HNutrTCRcxxnsM3teF4P5i7CPod5DL/BPw7HsuF23KICWCYewEG4C/sV6+ozL4MHmQ44BZvzuJhouYrpogbOwbU84ng+PYNECYzAD7Dcr/kbFLrgJHwSpBtFPxBBYnDZ7zimn0FiCo3KKVWq8xJpIq/hBKw14R7CJBrhjLx8F8Rm9X9RAb/CTZPimHAGiS/oHfwiN5ZG3qbroglG4QvT9zE6qIbrcmoZja416G0Q4ugM9DAot++6Ai3AGwZS8wt2wwMGUrMKn8LP8JqBnLmCnyz7mU6MgdQkYY9lP9JIMpCaFbkf+wgvGciZW7n1EOvTPAOpOYRvYCfcYiA1cfgcDsFzBnImDadhPfwOMwzkzAkcgC9hgoHU/IDtMtYxAzmTkdOtwbJ/DkqbGCh1z1XID8TCPQxb5ILuxI6uQFHF5+L9oH2fz6if8pag759NsHhqMOJ2UK8vUImXAiLyG6yCvy37N3Px1tmFxulXBnst+zn3EtzWFajgYSAGYiAGYiAGYiAGYiDCQAzEQAzEQAzEQAxEcvgrwADvsYR/Evmv3QAAAABJRU5ErkJggg==";class H{constructor(e,t){this.player=e,this.clickHandle=t,this.$html=f(P)}createEl(e){if(this.clickHandle){this.$html.onclick=()=>{typeof this.clickHandle=="function"?this.clickHandle():typeof this.clickHandle=="string"&&(window.location.href=this.clickHandle)},this.$html.style.backgroundImage=`url(${R})`;const t=e.querySelector(".vjs-play-control");S(this.$html,t)}}dispose(){this.$html.parentNode.removeChild(this.$html)}}const _='<div class="memory-play-wrap"></div>',te="";class G{constructor(e,t=!1,s,n,o){this.html=f(_),this.player=e,this.autoPlay=t,this.getTime=s||this._getTime,this.saveTimeFunction=n||this._saveTime,this.hasMemoryDisplay=!1,this.htime=o||0,this.memoryKey="tcplayer_memory_"}createEl(e){e.appendChild(this.html)}ready(){try{const c=this.player;let y=this,u=c.options_||{},l="";u.fileID?l=u.fileID:u.src&&(l=u.src.replace(/\?.*$/,"")),this.memoryKey="tcplayer_memory_"+l;let a=0;this.htime>0?a=this.htime:a=this.getTime(this.memoryKey)?parseInt(this.getTime(this.memoryKey)):0,this.hasMemoryDisplay=!1;var e,t,s,n;if(t=this.getVideoTime(a),e=this.getVideoTime(this.htime),!this.hasMemoryDisplay&&a>0){this.hasMemoryDisplay=!0;let C=0;try{C=c.duration()||0}catch(d){console.error("\u83B7\u53D6\u89C6\u9891\u65F6\u957F\u5931\u8D25:",d)}if(a<=parseInt(C)-2){var o="";n=0,s=t,this.autoPlay?(o=`<div class="memory-play"><span>\u60A8\u4E0A\u6B21\u5B66\u4E60\u5230${s}\u5DF2\u81EA\u52A8\u4E3A\u60A8\u7EED\u64AD</span><span class="play-jump">\u4ECE\u5934\u64AD\u653E</span><i class="iconfont icon-close"></i></div>`,c.currentTime(a)):o=`<div class="memory-play"><span>\u60A8\u4E0A\u6B21\u5B66\u4E60\u5230${s}</span><span class="play-jump">\u7EE7\u7EED\u64AD\u653E</span><i class="iconfont icon-close"></i></div>`,c.paused()&&this.autoPlay,this.html.innerHTML=o;let d=setTimeout(()=>{this.html.innerHTML=""},5e3);var r=this.html.querySelector(".icon-close");r&&(r.onclick=()=>{this.html.innerHTML="",clearTimeout(d)});var h=this.html.querySelector(".play-jump");h&&(h.onclick=()=>{if(this.autoPlay?c.currentTime(0):c.currentTime(a),c.paused()&&this.autoPlay)try{c.play().catch(T=>{console.warn("\u70B9\u51FB\u540E\u64AD\u653E\u88AB\u963B\u6B62\uFF0C\u8FD9\u79CD\u60C5\u51B5\u5F88\u5C11\u89C1:",T)})}catch(T){console.warn("\u64AD\u653E\u5C1D\u8BD5\u5931\u8D25:",T)}this.html.innerHTML="",clearTimeout(d)})}}setTimeout(()=>{!this.hasMemoryDisplay&&a>0&&this.processMemoryPlayPrompt(a)},500),this.setupTimeSaving()}catch(c){console.error(c)}}error(){this.setMemory()}dispose(){this.setMemory(),this.visibilityHandler&&document.removeEventListener("visibilitychange",this.visibilityHandler),this.unloadHandler&&window.removeEventListener("beforeunload",this.unloadHandler),this.progressInterval&&clearInterval(this.progressInterval)}processMemoryPlayPrompt(e){const t=this.player;this.hasMemoryDisplay=!0;let s=0;try{s=t.duration()||0}catch(n){console.error("\u83B7\u53D6\u89C6\u9891\u65F6\u957F\u5931\u8D25:",n)}if(e<=parseInt(s)-2){const n=this.getVideoTime(e);let o="";this.autoPlay?(o=`<div class="memory-play"><span>\u60A8\u4E0A\u6B21\u5B66\u4E60\u5230${n}\u5DF2\u81EA\u52A8\u4E3A\u60A8\u7EED\u64AD</span><span class="play-jump">\u4ECE\u5934\u64AD\u653E</span><i class="iconfont icon-close"></i></div>`,t.currentTime(e)):o=`<div class="memory-play"><span>\u60A8\u4E0A\u6B21\u5B66\u4E60\u5230${n}</span><span class="play-jump">\u7EE7\u7EED\u64AD\u653E</span><i class="iconfont icon-close"></i></div>`,this.html.innerHTML=o;let r=setTimeout(()=>{this.html.innerHTML=""},5e3);const h=this.html.querySelector(".icon-close");h&&(h.onclick=()=>{this.html.innerHTML="",clearTimeout(r)});const c=this.html.querySelector(".play-jump");c&&(c.onclick=()=>{if(this.autoPlay?t.currentTime(0):t.currentTime(e),t.paused())try{t.play().catch(y=>{console.warn("\u70B9\u51FB\u540E\u64AD\u653E\u88AB\u963B\u6B62:",y)})}catch(y){console.warn("\u64AD\u653E\u5C1D\u8BD5\u5931\u8D25:",y)}this.html.innerHTML="",clearTimeout(r)})}}setupTimeSaving(){const e=this.player;let t=this;document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=function(){document.visibilityState==="hidden"&&e.currentTime()>0&&t.saveTimeFunction(t.memoryKey,e.currentTime())},document.addEventListener("visibilitychange",this.visibilityHandler),window.removeEventListener("beforeunload",this.unloadHandler),this.unloadHandler=function(){e.currentTime()>0&&t.saveTimeFunction(t.memoryKey,e.currentTime())},window.addEventListener("beforeunload",this.unloadHandler),this.progressInterval=setInterval(()=>{!e.paused()&&e.currentTime()>0&&t.saveTimeFunction(t.memoryKey,e.currentTime())},3e4)}setMemory(){const e=this.player;try{if(!e||typeof e.currentTime!="function")return;const t=e.currentTime();t>0&&this.saveTimeFunction(this.memoryKey,t)}catch(t){console.error("\u4FDD\u5B58\u8BB0\u5FC6\u65F6\u95F4\u5931\u8D25:",t)}}getVideoTime(e){let t=Math.round(e),s=Math.floor(t/3600),n=Math.floor((t-s*3600)/60),o=t-s*3600-n*60;return n<10&&(n="0"+n),o<10&&(o="0"+o),s===0?n+":"+o:s+":"+n+":"+o}_getTime(e){return localStorage.getItem(e)}_saveTime(e,t){localStorage.setItem(e,t)}}const Y=` <div class="quality-components"> <div class="current-quality-cto" data-ref=""></div> <ul class="quality-list"> </ul> </div> `,B=` <div class="quality-modal"> <span class="switchimg"></span> <span class="current-quality-tag"></span> , <span class="wait"></span> </div> `,ie="";class L{constructor(e,t,s,n){this.player=e,this.html=f(Y),this.modalHtml=f(B),this.hasCreated=!1,this.definition=s,this.getQuality=t,this.desc=n,this.html.style.display="none"}createEl(e){const t=this.player;let s=!1;try{typeof t.lang=="function"?s=t.lang()==="en-us":typeof t.lang=="string"?s=t.lang==="en-us":t.options_&&t.options_.language&&(s=t.options_.language==="en-us")}catch{console.warn("\u65E0\u6CD5\u83B7\u53D6\u64AD\u653E\u5668\u8BED\u8A00\u8BBE\u7F6E\uFF0C\u4F7F\u7528\u9ED8\u8BA4\u4E2D\u6587")}this.isEn=s,this.html.querySelector(".current-quality-cto").innerText=this.isEn?"Resolution":this.desc||"\u6E05\u6670\u5EA6",this.modalHtml.querySelector(".switchimg").innerText=this.isEn?"Switching to you for":"\u6B63\u5728\u4E3A\u60A8\u5207\u6362\u5230",this.modalHtml.querySelector(".wait").innerText=this.isEn?"Please wait...":"\u8BF7\u7A0D\u540E...";let n=e.querySelector(".vcp-controls-panel");n?n.appendChild(this.html):(console.warn("\u627E\u4E0D\u5230\u64AD\u653E\u5668\u63A7\u5236\u680F\uFF0C\u5C1D\u8BD5\u6DFB\u52A0\u5230\u6839\u5143\u7D20"),e.appendChild(this.html)),e.appendChild(this.modalHtml)}setCurrentQuality(e,t){this.html.style.display="block";let s=this.html.querySelector(".current-quality-cto");s.innerText=e,s.dataset.def=t,this.definition=t;let n=this.html.querySelector(".quality-list"),o=n.querySelector(".current");o&&(o.className="");let r=n.querySelector(`li[data-def="${t}"]`);r&&(r.className="current")}filterDefinitionList(e){return e.filter(t=>t.definition!=="SD")}created(){const e=this.player;try{let n=[];if(e.getVideoQualityList&&typeof e.getVideoQualityList=="function")n=e.getVideoQualityList();else if(e.qualities&&typeof e.qualities=="function")n=e.qualities();else if(e.tech_&&e.tech_.hls&&e.tech_.hls.representations){const l=e.tech_.hls.representations();n=Array.from(l).map((a,C)=>({definition:a.height+"p",name:a.height+"p",url:a.id}))}else console.warn("\u65E0\u6CD5\u83B7\u53D6\u6E05\u6670\u5EA6\u5217\u8868\uFF0C\u4F7F\u7528\u9ED8\u8BA4\u503C"),n=[{definition:"HD",name:"\u8D85\u6E05",url:""},{definition:"SD",name:"\u6807\u6E05",url:""}];this._urls=n.map(l=>({definition:l.definition||l.id||"HD",desc:l.name||l.label||"\u9AD8\u6E05",Url:l.url||""})),(!this._urls||this._urls.length===0)&&(this._urls=[{definition:"HD",desc:"\u8D85\u6E05",Url:""},{definition:"SD",desc:"\u6807\u6E05",Url:""}]);for(var t=0;t<this._urls.length;t++)this._urls[t].definition==="AUTO"&&(this._urls[t].desc="\u81EA\u52A8"),this._urls[t].desc||(this._urls[t].desc="");let o=this.html.querySelector(".current-quality-cto"),r=this.html.querySelector(".quality-list");if(!o||!r){console.error("\u6E05\u6670\u5EA6\u7EC4\u4EF6HTML\u5143\u7D20\u672A\u627E\u5230");return}let c=this.filterDefinitionList(this._urls).map(l=>`<li data-def="${l.definition}">${l.desc}</li>`);const y=this.html.querySelector(".quality-list");if(y&&(y.innerHTML=c.join("")),this.hasCreated==!1){if(!this.definition&&this._urls.length>0){let l=r.querySelector(`li[data-def="${this._urls[0].definition}"]`);l&&(l.className="current",o.innerText=this._urls[0].desc)}else for(var t=0;t<this._urls.length;t++)if(this.definition==this._urls[t].definition){var s=r.querySelector(`li[data-def="${this.definition}"]`);s&&(s.className="current",o.innerText=this._urls[t].desc);break}}this.hasCreated=!0;let u=null;o.onclick=()=>{r.style.display="block"},o.onmouseleave=()=>{u=setTimeout(()=>{r.style.display="none"},100)},r.onmouseenter=()=>{clearTimeout(u)},r.onmouseleave=()=>{r.style.display="none"},r.onclick=({target:l})=>{let a=l.dataset.def,C=l.innerText;if(a&&l.className!=="current"){let d=this._urls.find(g=>g.definition===a);if(!d)return;let T=0;try{T=e.currentTime()}catch(g){console.warn("\u65E0\u6CD5\u83B7\u53D6\u5F53\u524D\u64AD\u653E\u65F6\u95F4",g)}try{if(e.switchQuality&&typeof e.switchQuality=="function")e.switchQuality(a);else if(e.tech_&&e.tech_.hls&&e.tech_.hls.selectPlaylist){const g=e.tech_.hls.representations(),$=Array.from(g).find(X=>X.height+"p"===a);$&&$.enabled(!0)}}catch(g){console.warn("\u5207\u6362\u6E05\u6670\u5EA6\u5931\u8D25",g)}this.setCurrentQuality(d.desc,d.definition),this.modalHtml.style.display="block";const b=this.modalHtml.querySelector("span.current-quality-tag");b&&(b.innerText=d.desc),setTimeout(()=>{try{e.currentTime(T)}catch(g){console.warn("\u65E0\u6CD5\u8BBE\u7F6E\u64AD\u653E\u65F6\u95F4",g)}},500)}console.log(a,"getQuality-definition"),console.log(C,"getQuality-desc");try{localStorage.setItem("cto_video_definition",a),localStorage.setItem("cto_video_desc",C)}catch(d){console.warn("\u65E0\u6CD5\u4FDD\u5B58\u6E05\u6670\u5EA6\u8BBE\u7F6E\u5230localStorage",d)}u=setTimeout(()=>{r.style.display="none"},100)}}catch(n){console.error("QualityComponent\u521B\u5EFA\u8FC7\u7A0B\u51FA\u9519:",n)}}ready(){const e=this.player;try{let t=null;if(e.getVideoQuality&&typeof e.getVideoQuality=="function")try{t=e.getVideoQuality(),console.log(t,"Quality")}catch(s){console.warn("\u83B7\u53D6\u89C6\u9891\u6E05\u6670\u5EA6\u5931\u8D25",s)}this.modalHtml&&(this.modalHtml.style.display="none");try{let s=document.querySelector(".vcp-quality");s&&(s.style.display="none")}catch(s){console.warn("\u65E0\u6CD5\u9690\u85CF\u539F\u59CB\u6E05\u6670\u5EA6\u6309\u94AE",s)}}catch(t){console.error("QualityComponent ready\u8FC7\u7A0B\u51FA\u9519:",t)}}}const U=` <div class="rate-components"> <div class="current-rate">1.0x</div> <ul class="rate-list"> <li data-rate="2.0">2.0x</li> <li data-rate="1.75">1.75x</li> <li data-rate="1.5">1.5x</li> <li data-rate="1.25">1.25x</li> <li data-rate="1.0" class="current">1.0x</li> <li data-rate="0.5">0.5x</li> </ul> </div> `,se="";class Q{constructor(e){this.html=f(U),this.player=e,this.hasCreated=!1,this.rate=this.getRate()}createEl(e){try{if(!e){console.warn("RateComponent: DOM\u5143\u7D20\u4E0D\u5B58\u5728");return}let t=e.querySelector(".vcp-controls-panel");if(!t){console.warn("RateComponent: \u65E0\u6CD5\u627E\u5230\u63A7\u5236\u680F\u5143\u7D20\uFF0C\u5C1D\u8BD5\u6DFB\u52A0\u5230\u6839\u5143\u7D20"),e.appendChild(this.html);return}t.appendChild(this.html)}catch(t){console.error("RateComponent\u521B\u5EFADOM\u5143\u7D20\u5931\u8D25:",t)}}created(){if(this.hasCreated==!1){if(this.rate){this.player.playbackRate(parseFloat(this.rate));let t=this.html.querySelector('li[class="current"]');t&&(t.className="");let s=this.html.querySelector(`li[data-rate="${this.rate}"]`);s&&(s.className="current")}else this.rate="1.0";let e=this.html.querySelector(".current-rate");e.innerText=this.rate+"x"}this.hasCreated=!0}ready(){let e=this.html.querySelector(".current-rate"),t=this.html.querySelector(".rate-list"),s=null,n=document.querySelector(".vcp-rate");n&&(n.style.display="none"),e.onclick=()=>{t.style.display="block"},e.onmouseleave=()=>{s=setTimeout(()=>{t.style.display="none"},100)},t.onmouseenter=()=>{clearTimeout(s)},t.onmouseleave=()=>{t.style.display="none"},t.onclick=({target:o})=>{let r=o.dataset.rate;if(r){if(this.player.playbackRate(parseFloat(r)),o.className!=="current"){let h=t.querySelector(".current");h&&(h.className=""),o.className="current"}t.style.display="none",e.innerText=r+"x",this.setRate(r)}}}setRate(e){localStorage.setItem("cto_video_Rate",e)}getRate(){return localStorage.getItem("cto_video_Rate")}}const ne="";class F{constructor(e,t,s,n="random"){this.text=t,this.style=s||{fontSize:"14px",color:"#fff"},this.html=f('<div class="bullet-screen paused"></div>'),this.bulletPosition=n,this.mintime=90,this.maxtime=180,this.animationtime=10,this.time=0,this.stoptime=0,this.start=new Date,this.player=e}createEl(e){this.html.innerText=this.text,e.appendChild(this.html)}ready(e){const t=this.player;t.autoplay()===!1&&(this.html.style.animationPlayState="paused"),Object.keys(this.style).forEach(r=>this.html.style[r]=this.style[r]);var s=this.html.offsetHeight,n=parseInt(t.height()),o=n-s;if(this.bulletPosition==="bottom")this.html.style.bottom=0;else{let r=this.bulletPosition==="top"?0:this.randomTop(o);this.html.style.top=r}this.bulletPosition==="random"&&this.html.addEventListener("animationiteration",()=>{this.html.style.top=this.randomTop(o)}),this.html.style.webkitAnimationDuration=this.animationtime+"s",this.start=new Date}playing(e){console.log("bulletplayering"),this.html.style.animationPlayState="running",this.start=new Date}timeupdate(e){const t=this.player;var s=Math.random();this.maxtime-this.mintime>0?s=this.mintime+(this.maxtime-this.mintime)*s:s=0;let n=t.el(),o=n.querySelector(".bullet-screen");if(this.time=new Date-this.start+this.stoptime,!o)this.time-this.animationtime*1e3-s*1e3>0&&(n.appendChild(this.html),this.start=new Date,this.stoptime=0);else if(this.time-this.animationtime*1e3>0)o.remove(),this.stoptime=0;else{o.className!=="bullet-screen"&&(o.className="bullet-screen");let r=getComputedStyle(o),h=r.getPropertyValue("display"),c=r.getPropertyValue("opacity"),y=r.getPropertyValue("visibility"),u=this.text,l=o.innerText;h==="none"&&o.style.setProperty("display","block"),c!=="1"&&o.style.setProperty("opacity","1"),y==="hidden"&&o.style.setProperty("visibility","visible"),u!=l&&(o.innerText=u)}}pause(e){console.log("pause"),this.html.style.animationPlayState="paused"}randomTop(e){return Math.floor(Math.random()*e)+"px"}}const Z={CountdownHtml:'<div class="countdown-wrap"><div class="countdown"></div></div>',RateHtml:'<div class="player-rate-wrap"><div class="player-rate-tips">\u8FD9\u8282\u8BFE\u7A0B\u60A8\u662F\u5426\u6EE1\u610F\uFF1F</div><div class="player-rate-box"><div class="player-star-wrap"><i class="player-icon player-star" data-id="1"></i><i class="player-icon player-star" data-id="2"></i><i class="player-icon player-star" data-id="3"></i><i class="player-icon player-star" data-id="4"></i><i class="player-icon player-star" data-id="5"></i></div><div class="player-rate-txt">\u8BC4\u5206</div></div></div>'},oe="";class O{constructor(e,t=!0,s,n,o){this.html=f(Z.CountdownHtml),this.player=e,this.open=t,this.time=s||15,this.type=n,this.isClicked=!1,this.starOpen=o,this.player.on("timeupdate",()=>this.timeupdate())}createEl(e){this.open&&e.appendChild(this.html)}timeupdate(){const e=this.player;if(this.type=="star"){var t=e.duration()-e.currentTime();t<=this.time&&this.starOpen()}else if(this.open){var s=this.html.querySelector(".countdown"),t=e.duration()-e.currentTime();if(t<=this.time){t=t-t%1+1;var n=`<div class="countdown-txt"> <span class="time">${t}s</span>\u540E\u4E3A\u60A8\u64AD\u653E\u4E0B\u4E00\u8282 </div>`;s.innerHTML=n}else s.innerHTML=""}}getVideoTime(e){let t=Math.round(e),s=Math.floor(t/3600),n=Math.floor((t-s*3600)/60),o=t-s*3600-n*60;return n<10&&(n="0"+n),o<10&&(o="0"+o),s===0?n+":"+o:s+":"+n+":"+o}}const z=` <div class="prism-snapshot-btn"></div> `,re="";class j{constructor(e){this.player=e,this.html=f(z)}createEl(e){const t=e.querySelector(".vjs-control-bar"),s=t.querySelector(".tcp-video-quality-switcher");t.insertBefore(this.html,s.nextSibling)}ready(){this.html.addEventListener("click",()=>{this.captureSnapshot()})}captureSnapshot(){const e=this.player,t=e.tech_.el_;if(!t){console.error("\u89C6\u9891\u5143\u7D20\u4E0D\u5B58\u5728");return}const s=document.createElement("canvas");s.width=t.videoWidth,s.height=t.videoHeight,s.getContext("2d").drawImage(t,0,0,s.width,s.height);try{const o=s.toDataURL("image/png"),r=document.createElement("a");r.href=o;const h=new Date().toISOString().replace(/[:.]/g,"-"),y=`${e.el_.getAttribute("title")||"video"}_${h}.png`;r.download=y,document.body.appendChild(r),r.click(),document.body.removeChild(r)}catch(o){console.error("\u622A\u56FE\u5931\u8D25:",o)}}}const m={PlayerNextComponent:D,PlayPrevComponent:H,MemoryPlayComponent:G,QualityComponent:L,RateComponent:Q,BulletScreenComponent:F,CountdownComponent:O,SnapshotComponent:j};window.TcPlayerComponent=m;function q(i){!i||(i.lang||(i.lang=function(e){return{Play:"\u64AD\u653E",Pause:"\u6682\u505C",Mute:"\u9759\u97F3",Unmute:"\u53D6\u6D88\u9759\u97F3",Fullscreen:"\u5168\u5C4F","Exit Fullscreen":"\u9000\u51FA\u5168\u5C4F",Settings:"\u8BBE\u7F6E",Speed:"\u901F\u5EA6",Normal:"\u6B63\u5E38",Quality:"\u8D28\u91CF",Auto:"\u81EA\u52A8",HD:"\u9AD8\u6E05",SD:"\u6807\u6E05"}[e]||e}),i.options_||(i.options_=i.options_||{}),i.options_&&!i.options_.languages&&(i.options_.languages={"zh-CN":{Play:"\u64AD\u653E",Pause:"\u6682\u505C",Mute:"\u9759\u97F3",Unmute:"\u53D6\u6D88\u9759\u97F3",Fullscreen:"\u5168\u5C4F","Exit Fullscreen":"\u9000\u51FA\u5168\u5C4F",Settings:"\u8BBE\u7F6E",Speed:"\u901F\u5EA6",Normal:"\u6B63\u5E38",Quality:"\u8D28\u91CF",Auto:"\u81EA\u52A8",HD:"\u9AD8\u6E05",SD:"\u6807\u6E05"}},i.options_.language="zh-CN"))}function V(i,e){if(!i)return[];const t=[];try{if(!e||!Array.isArray(e))return t;e.forEach(s=>{try{if(s.type&&typeof s.type=="function"){if(!i||!i.el_){console.warn("\u64AD\u653E\u5668\u5B9E\u4F8B\u4E0D\u5B8C\u6574\uFF0C\u8DF3\u8FC7\u7EC4\u4EF6\u6CE8\u518C",s.name);return}let n;try{n=new s.type(i,...s.args||[])}catch(o){console.error(`\u7EC4\u4EF6 ${s.name} \u521D\u59CB\u5316\u5931\u8D25:`,o);return}if(s.name){if(i._components||(i._components={}),i._components[s.name]=n,t.push(n),i.getComponent||(i.getComponent=function(o){return this._components&&this._components[o]}),n.createEl&&typeof n.createEl=="function")try{i.el_&&i.el_.nodeType===1?n.createEl(i.el_):console.warn(`\u7EC4\u4EF6 ${s.name} \u8DF3\u8FC7DOM\u521B\u5EFA\uFF0C\u64AD\u653E\u5668\u5143\u7D20\u4E0D\u5B58\u5728`)}catch(o){console.error(`\u7EC4\u4EF6 ${s.name} \u521B\u5EFADOM\u5143\u7D20\u5931\u8D25:`,o),console.log("\u7EC4\u4EF6:",n),console.log("\u9519\u8BEF\u8BE6\u60C5:",o)}if(n.created&&typeof n.created=="function")try{n.created()}catch(o){console.error(`\u7EC4\u4EF6 ${s.name} created\u65B9\u6CD5\u6267\u884C\u5931\u8D25:`,o)}}}}catch(n){console.error("\u5904\u7406\u63D2\u4EF6\u65F6\u53D1\u751F\u9519\u8BEF:",n)}})}catch(s){console.error("\u6CE8\u518C\u7EC4\u4EF6\u9519\u8BEF:",s)}return t}function J(i){if(!(!i||!i._components))try{Object.values(i._components).forEach(e=>{try{e.ready&&typeof e.ready=="function"&&e.ready()}catch(t){console.error("\u7EC4\u4EF6ready\u65B9\u6CD5\u6267\u884C\u5931\u8D25:",t)}})}catch(e){console.error("\u521D\u59CB\u5316\u7EC4\u4EF6ready\u72B6\u6001\u5931\u8D25:",e)}}function W(i){if(!(!i||!i._components))try{Object.values(i._components).forEach(e=>{try{e.destroy&&typeof e.destroy=="function"&&e.destroy()}catch(t){console.error("\u7EC4\u4EF6destroy\u65B9\u6CD5\u6267\u884C\u5931\u8D25:",t)}}),i._components={}}catch(e){console.error("\u9500\u6BC1\u7EC4\u4EF6\u5931\u8D25:",e)}}const k={addPlayerCompatLayer:q,registerComponents:V,initComponentsReadyState:J,destroyComponents:W},le="";window._pursuer=window._pursuer||{};const A=window._pursuer,E={name:"PsTcPlayer",props:{config:{default(){return{}}}},data(){return{id:"",duration:0,currentTime:0,hearttime:2e4,timers:[],_readyCalled:!1}},render(){return v.h("div",{class:"ps-player",style:{width:"100%",height:"100%",position:"relative"}},[v.h("video",{class:"ps-player-container",style:{overflow:"hidden",position:"relative",width:"100%",height:"100%"},attrs:{preload:"auto",playsinline:"","webkit-playsinline":"",tabindex:"1",id:this.id},preload:"auto",playsinline:"","webkit-playsinline":"",tabindex:"1",id:this.id,ref:"playerBox"})])},watch:{config:{handler(i,e){if(!e||Object.keys(e).length===0){console.log("\u521D\u59CB\u914D\u7F6E\uFF0C\u901A\u8FC7mounted\u94A9\u5B50\u521D\u59CB\u5316");return}this._source_loded&&JSON.stringify(i)!==JSON.stringify(e)&&(console.log("\u914D\u7F6E\u53D8\u66F4\uFF0C\u91CD\u65B0\u521D\u59CB\u5316\u64AD\u653E\u5668"),this.$nextTick(()=>{this.init()}))},deep:!0}},mounted(){if(!window)return!1;this.id=this.getCfPlayerId();let i=[];const e="//web.sdk.qcloud.com/player/tcplayer/release/v4.5.2/tcplayer.v4.5.2.min.js",t="//web.sdk.qcloud.com/player/tcplayer/release/v4.5.2/tcplayer.min.css",s="//web.sdk.qcloud.com/player/tcplayer/release/v4.5.2/libs/hls.min.0.13.2m.js";window.TCPlayer||(i=[t,s,e]),w(i,()=>{this._source_loded=!0,this.$nextTick(()=>{this.init()})}),this.$playerBox=document,this.$playerBox.addEventListener("keydown",this.onkeydown,!0),this.$playerBox.addEventListener("keyup",this.onkeyup,!0)},beforeDestroy(){this.destroy()},beforeUnmount(){this.destroy()},methods:{getCfPlayerId(){return A.playerCount=A.playerCount?A.playerCount+1:1,this.config&&this.config.id||"player-container-id"},init(){if(!document.querySelector(`#${this.id}`))return console.log(`#${this.id} dom is not found`);const i={width:"686px",height:"450px",reportable:!0,plugins:{ContinuePlay:{auto:!0},ProgressMarker:!1,ContextMenu:{levelSwitch:{open:!0,switchingText:"\u6B63\u5728\u4E3A\u60A8\u5207\u6362\u5230",switchedText:"",switchErrorText:""}}}};this.initPlayer({...this.config,...i,...this.config.tconfig||{}})},setupPlugins(){const i=this,e=[];try{(i.config.onnext||i.config.showNext)&&e.push({name:"PlayerNextComponent",type:m.PlayerNextComponent,args:[i.onnext]}),(i.config.onpre||i.config.showPre)&&e.push({name:"PlayPrevComponent",type:m.PlayPrevComponent,args:[i.onpre]});const t=i.config.tconfig&&i.config.tconfig.plugins&&i.config.tconfig.plugins.ContinuePlay,s=i.config.htime||0,n=t?t.auto===!0:!1;try{e.push({name:"MemoryPlayComponent",type:m.MemoryPlayComponent,args:[n,null,null,s]})}catch(o){console.error("\u6DFB\u52A0MemoryPlayComponent\u5931\u8D25:",o)}if(e.push({name:"QualityComponent",type:m.QualityComponent,args:[null,"HD","\u9AD8\u6E05"]}),e.push({name:"RateComponent",type:m.RateComponent}),e.push({name:"SnapshotComponent",type:m.SnapshotComponent}),i.config.bulletScreen,e.push({name:"BulletScreenComponent",type:m.BulletScreenComponent,args:[i.config.bulletContent||"\u5B66\u4E60\u6210\u5C31\u68A6\u60F3",i.config.bulletStyle||{fontSize:"16px",color:"#fff"},"random"]}),i.config.onnext||i.config.showNext,e.push({name:"CountdownComponent",type:m.CountdownComponent,args:[i.config.onnext||i.config.showNext?!0:"",!1,i.config.star,i.config.openStar]}),this.config.tconfig&&this.config.tconfig.plugins){const o={...this.config.tconfig.plugins};delete o.ContinuePlay,Object.keys(o).forEach(r=>{const h=o[r];typeof h=="object"&&!Array.isArray(h)&&e.push({name:r,config:h})})}}catch(t){console.error("\u8BBE\u7F6E\u63D2\u4EF6\u65F6\u51FA\u9519:",t)}return e},initPlayer(i){if(console.log("\u521D\u59CB\u5316\u64AD\u653E\u5668\u914D\u7F6E:",i),this.$player&&(console.log("\u64AD\u653E\u5668\u5B9E\u4F8B\u5DF2\u5B58\u5728\uFF0C\u9500\u6BC1\u65E7\u5B9E\u4F8B"),this.destroy()),!window.TCPlayer)return console.warn("TCPlayer \u672A\u52A0\u8F7D\uFF0C\u65E0\u6CD5\u521D\u59CB\u5316\u64AD\u653E\u5668"),!1;console.log("\u521B\u5EFA TCPlayer \u5B9E\u4F8B\uFF0C\u914D\u7F6E:",i),this.hearttime=this.config.hearttime||this.hearttime,this.runs(i)},runs(i){if(this.$player=new TCPlayer(this.id,i),console.log("\u521B\u5EFA\u64AD\u653E\u5668\u5B9E\u4F8B\uFF0C\u914D\u7F6E:",i),this.$player){k.addPlayerCompatLayer(this.$player);let e=[];try{e=this.setupPlugins()||[]}catch(t){console.error("\u8BBE\u7F6E\u63D2\u4EF6\u65F6\u51FA\u9519:",t)}this.$player.on("ready",()=>{setTimeout(()=>{try{k.registerComponents(this.$player,e),this.onready()}catch(t){console.error("\u6CE8\u518C\u7EC4\u4EF6\u8FC7\u7A0B\u4E2D\u53D1\u751F\u9519\u8BEF:",t)}},500)}),this.$player.on("error",this.onerror),this.$player.on("timeupdate",this.ontimeupdate),this.$player.on("pause",this.onpause),this.$player.on("play",this.onplay),this.$player.on("ended",this.onended),this.$player.on("waiting",this.onwaiting),this.$player.on("snapshoted",this.onsnapshoted),this.$player.on("sourceloaded",this.onsourceloaded)}else{console.error("TCPlayer\u5B9E\u4F8B\u521B\u5EFA\u5931\u8D25");return}this.$player.getDuration=this.$player.duration,this.$player.getCurrentTime=this.$player.currentTime,this.$player._el=this.$player.el_,this.$player.seek=this.$player.currentTime,this.$player.getStatus=this.$player.getStatus||function(){return this.$player.paused()?"pause":"playing"}.bind(this),this.$player.destroy=this.$player.dispose,this.$player._originalPlaybackRate=this.$player.playbackRate,this.$player.getVolume=this.$player.volume,this.$player.setVolume=this.$player.volume},onready(){if(!this._readyCalled){this._readyCalled=!0,this.onheart(!0),this.$emit("onready",this.$player),this.config.onready&&this.config.onready(this.$player);try{k.initComponentsReadyState(this.$player)}catch(i){console.error("\u521D\u59CB\u5316\u7EC4\u4EF6ready\u65B9\u6CD5\u5931\u8D25:",i)}}},onsourceloaded(i){const e=i.paramData,t=e.desc,s=e.definition,n=this.$player.getComponent&&this.$player.getComponent("QualityComponent");n&&n.setCurrentQuality&&n.setCurrentQuality(t,s)},onerror(i){this.$emit("onerror",this.$player),this.config.onerror&&this.config.onerror(this.$player)},ontimeupdate(){this.onheart(),this.duration=this.$player.getDuration(),this.currentTime=this.$player.getCurrentTime(),this.$emit("ontimeupdate",this.duration,this.currentTime,this.$player),this.config.ontimeupdate&&this.config.ontimeupdate(this.duration,this.currentTime,this.$player)},onpause(){this.$emit("onpause",this.$player),this.config.onpause&&this.config.onpause(this.$player)},onplay(){this.$emit("onplay",this.$player),this.config.onplay&&this.config.onplay(this.$player)},onended(){this.onheart(!0),this.$emit("onended",this.$player),this.config.onended&&this.config.onended(this.$player)},onnext(){this.$emit("onnext",this.$player),this.config.onnext&&this.config.onnext(this.$player)},onpre(){this.$emit("onpre",this.$player),this.config.onpre&&this.config.onpre(this.$player)},onwaiting(){this.$emit("onwaiting",this.$player),this.config.onwaiting&&this.config.onwaiting(this.$player)},onsnapshoted(i){this.$emit("onsnapshoted",i,this.$player),this.config.onsnapshoted&&this.config.onsnapshoted(i,this.$player)},onheart(i){if(i)return this.$emit("onheart",this.$player),this.config.onheart&&this.config.onheart(this.$player),!1;if(this.onheart_lock)return!1;clearTimeout(this.timers[0]),this.timers[0]=null,this.onheart_lock=!0,this.timers[0]=setTimeout(()=>{this.onheart_lock=!1,this.$emit("onheart",this.$player),this.config.onheart&&this.config.onheart(this.$player)},this.hearttime)},destroy(){if(this.$player){clearTimeout(this.timers[0]||null),this.onheart_lock=!1,this.$player.off("ready",this.onready),this.$player.off("error",this.onerror),this.$player.off("timeupdate",this.ontimeupdate),this.$player.off("pause",this.onpause),this.$player.off("play",this.onplay),this.$player.off("ended",this.onended),this.$player.off("waiting",this.onwaiting),this.$player.off("snapshoted",this.onsnapshoted),this.$player.off("sourceloaded",this.onsourceloaded);try{k.destroyComponents(this.$player)}catch(i){console.error("\u9500\u6BC1\u7EC4\u4EF6\u5931\u8D25:",i)}this.$player.destroy(),this.$player=null,this.$playerBox.removeEventListener("keydown",this.onkeydown,!1),this.$playerBox.removeEventListener("keyup",this.onkeyup,!1),this._readyCalled=!1}},getCurrentTime(){return this.$player&&this.$player.getCurrentTime()||0},onkeydown(i){if(!this.$player)return!1;const e=i.target,t=!e.hasAttribute("contenteditable")&&!/INPUT|TEXTAREA/gi.test(e.tagName);(i.keyCode===13||i.keyCode===32)&&t?this.$player.getStatus()==="playing"?this.$player.pause():this.$player.play():(i.keyCode===37||i.keyCode===39)&&t&&(this._keySeekTime=this.getCurrentTime(),i.keyCode===37?this._keySeekTime-=5:this._keySeekTime+=5)},seekTo(i){this.$player&&this.$player.seek(Number(i)||0)},onkeyup(i){if(!this.$player)return!1;const e=i.target,t=!e.hasAttribute("contenteditable")&&!/INPUT|TEXTAREA/gi.test(e.tagName);if(!((i.keyCode===37||i.keyCode===39)&&!t)){if(this.config.notProgress&&i.keyCode===39)return this._keySeekTime=null,!1;if(i.keyCode===37||i.keyCode===39){const s=this.$player.getDuration();this._keySeekTime<=0?this._keySeekTime=0:this._keySeekTime>=s&&(this._keySeekTime=s-5),this.seekTo(this._keySeekTime),this._keySeekTime=null}}}}};E.install=function(i,e={}){i.component(E.name,E);const t=v.isVue2?i.prototype:i.config.globalProperties;t.$tcPlayer=s=>(console.warn("\u4F7F\u7528 $tcPlayer \u521B\u5EFA\u72EC\u7ACB\u5B9E\u4F8B\u7684\u65B9\u5F0F\u5DF2\u5F03\u7528\uFF0C\u8BF7\u76F4\u63A5\u4F7F\u7528\u7EC4\u4EF6\u6807\u7B7E"),null)},Object.defineProperty(p,"version",{enumerable:!0,get:()=>v.version}),p.TcPlayerComponent=m,p.default=E,p.tcplayer=E,Object.defineProperties(p,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});