2 lines
1.2 KiB
JavaScript
2 lines
1.2 KiB
JavaScript
import{f as c}from"./flv.6f9a4929.js";import{a as p,r as d,f,G as h,af as S,H as g,J as k,k as w,o as B,h as V,i as v,bl as b}from"./index.d96edf17.js";const y=p({name:"VideoFlv",props:{url:{type:String,default:null},screen:{type:Boolean,default:!0},name:{type:String,default:""}},setup(t,{emit:o}){const a=d(null);let e=null;const s=d(t.url),u=f(()=>t.name),l=f(()=>t.screen);function r(){if(!!t.url&&c.isSupported()){let m=w(a);var n=c.createPlayer({type:"flv",isLive:!0,url:t.url});n.attachMediaElement(m),n.load(),n.play(),e=n}}h(()=>{r()});function _(){l.value?o("onScreen",{url:t.url,name:t.name}):o("onClick")}function i(){!e||(e==null||e.pause(),e==null||e.unload(),e==null||e.detachMediaElement(),e==null||e.destroy(),e=null)}return S(()=>{i()}),g(()=>t.url,n=>{n&&(i(),r())}),{pName:u,onScreen:_,isScreen:l,pUrl:s,videoRef:a}}}),E={class:"w-full h-full relative"},M={class:"w-full h-full bg-gray-700 bg-opacity-30",autoplay:"",controls:"",ref:"videoRef",muted:""};function $(t,o,a,e,s,u){return B(),V("div",E,[v("video",M,null,512),v("div",{class:"absolute left-0 w-full top-0 h-full",onClick:o[0]||(o[0]=b((...l)=>t.onScreen&&t.onScreen(...l),["prevent","stop"]))})])}var x=k(y,[["render",$],["__scopeId","data-v-c62ccadc"]]);export{x as default};
|