import{d as a,c as l,L as r,q as d}from"./index.8f93de0e.js";/* empty css             */import{T as o}from"./tcplayer.v4.8.0.min.5f81f63c.js";/* empty css                 */const p="_video_7tf49_1",c="_loadingVideo_7tf49_42",y="_playOver_7tf49_51",u="_tips_7tf49_59",h="_btn_7tf49_63",f="_replay_7tf49_70",g="_freeTxt_7tf49_73",m="_freeRate_7tf49_79";var s={"video-container":"_video-container_7tf49_1",video:p,loadingVideo:c,playOver:y,tips:u,btn:h,replay:f,freeTxt:g,freeRate:m},x=a({name:"o-video",props:{setting:{type:Object,default:()=>{}},controls:{type:Boolean,default:!0},height:String,src:{type:String,default:""},poster:{type:String,default:""},styleValue:{type:Object,default:()=>({})},preload:{type:String,default:"auto"},currentTime:{type:Boolean,default:!0},playsinline:{type:Boolean,default:!0},onPlay:{type:Function,default:()=>{}}},emits:["exitfullscreen"],data(){return{videoID:"video"+Date.now()+Math.floor(Math.random()*100),player:null,loading:!0}},mounted(){this._init()},methods:{_init(){const i=o.getComponent("Button"),t=o.getComponent("BigPlayButton");t.prototype.createEl=function(){const e=i.prototype.createEl.call(this),n='<button><svg width="41px"height="41px"viewBox="0 0 41 41"version="1.1"xmlns="http://www.w3.org/2000/svg"xmlns:xlink="http://www.w3.org/1999/xlink"><g stroke="none"stroke-width="1"fill="none"fill-rule="evenodd"><g transform="translate(-167.000000, -155.000000)"><g transform="translate(0.000000, 85.000000)"><g transform="translate(158.000000, 70.000000)"><g transform="translate(9.000000, 0.000000)"><circle id="\u692D\u5706\u5F62"stroke="#FFFFFF"fill-opacity="0.1"fill="#D8D8D8"cx="20.5"cy="20.5"r="20"></circle><path d="M14.5483871,27.6859997 L14.5483871,13.4342349 C14.5480523,12.8729571 14.8729597,12.356555 15.3949624,12.0887034 C15.9169651,11.8208518 16.5522696,11.8445472 17.0503046,12.1504437 L28.6530473,19.2778563 C29.1119763,19.5602271 29.3887725,20.0426422 29.3887725,20.5601173 C29.3887725,21.0775924 29.1119763,21.5600075 28.6530473,21.8423783 L17.0503046,28.9697909 C16.5522696,29.2756874 15.9169651,29.2993828 15.3949624,29.0315312 C14.8729597,28.7636796 14.5480523,28.2472775 14.5483871,27.6859997 Z"id="\u8DEF\u5F84"fill="#FFFFFF"fill-rule="nonzero"></path></g></g></g></g></g></svg></button>';return e.appendChild(o.dom.createEl("div",{className:"vjs-button-icon",innerHTML:n})),e},this.player=o(this.videoID,{appID:"",controls:this.controls}),this.player&&(this.player.src(this.src),this.player.poster(this.poster||""),this.preload==="none"&&(this.loading=!1),this.player.on("loadstart",()=>{this.loading=!1,this.domPlayVisibility(!1)}),this.player.on("play",()=>{this.onPlay&&this.onPlay(this.player)}),this.player.on("fullscreenchange",()=>{if(this.player.isFullscreen()){console.log("fullscreen");const e=document.createElement("i");e.id="fullscreen-back",e.className="van-icon van-icon-arrow-left video-back",e.addEventListener("click",()=>{this.player.exitFullscreen()}),document.getElementsByClassName("video-js")[0].appendChild(e)}else{console.log("exitfullscreen");const e=document.getElementById("fullscreen-back");e&&e.remove()}}))},domPlayVisibility(i=!0){const t=document.querySelector(".vjs-big-play-button"),e=document.querySelector(".vjs-control-bar");i?(t==null||t.setAttribute("style","display:none"),e==null||e.setAttribute("style","display:none")):(t==null||t.removeAttribute("style"),setTimeout(()=>{e==null||e.removeAttribute("style")},200))},onReplay(){this.player.currentTime(0),this.player.play(),this.domPlayVisibility(!1)},onStop(){this.player.currentTime(0),this.player.pause()}},unmounted(){var i,t,e;(i=this.player)==null||i.pause(),(t=this.player)==null||t.src(""),(e=this.player)==null||e.dispose()},render(){return l("div",{class:s["video-container"]},[l("video",{ref:"video",id:this.videoID,class:s.video,src:this.src,playsinline:this.playsinline,poster:this.poster,preload:this.preload,style:{...this.styleValue}},null),this.loading&&l("div",{class:s.loadingVideo,style:{height:this.height||"210px"}},[l(r,{size:36,color:"#FF8057",vertical:!0,style:{height:"100%",justifyContent:"center"}},{default:()=>[d("\u52A0\u8F7D\u4E2D...")]})])])}});export{x as O};
