preview-49f52d3d.js 3.8 KB

1
  1. import{d as b,e as P,k as A,o as L,r as F,w as g,x as G,X as s,a6 as d,Y as l,u as r,aa as k,F as D,a2 as M,Z as m,f as y}from"./vue-bbe2430e.js";import{aJ as U,s as q,G as H,bu as E,a3 as R,a0 as S,V as J}from"./radical-d5778ee4.js";import{a as W,u as V,b as X,V as T}from"./group-cb2f525f.js";import"./gb28181-8c8b3c56.js";import"./index-2915d01f.js";const Y={class:"text-center"},Z={key:1,class:"video-player-placeholder"},j=b({__name:"content-preview",props:{type:{default:"device"}},setup(N){const c=N,I=W(),n=V(),i=P({get:()=>n.curScreenNum,set:e=>n.setCurScreenNum(e)});P(()=>{switch(i.value){case 1:return 24;case 4:return 12;case 9:return 8;case 16:return 6;default:return 24}});const p=()=>document.querySelector(".screen-list"),w=A(null);U(w);const o=A(!1),v=()=>{try{if(typeof RTCRtpReceiver<"u"&&RTCRtpReceiver.getCapabilities){const e=RTCRtpReceiver.getCapabilities("video");e&&e.codecs&&e.codecs.some(t=>t.mimeType.toLowerCase().includes("h265")||t.mimeType.toLowerCase().includes("hevc"))||(o.value=!0)}else o.value=!0}catch(e){console.warn("检测 H265 支持时发生错误:",e),o.value=!0}};L(()=>{v()});const f=X(c.type==="device");n.setMultiPlayRef(f);const{updateItem:h,streamList:u,resetStreamList:z,closeAll:B,webrtc:$}=f,C=F({selectNum:1});g(i,async()=>{C.selectNum=0,c.type==="device"?(n.setActiveInfo({parentId:"",parentName:"",deviceId:"",name:""}),I.setCurPlayGroupId(-2)):n.setActiveInfo({path:"",type:""});const e=new Array(i.value).fill({}).map(()=>c.type==="device"?{path:"",deviceItem:{},stream:void 0}:{path:"",type:"",streamItem:{},stream:void 0});await z(e)},{immediate:!0});let x=!1;G(()=>B());const{getActiveInfo:_}=q(n);return g(()=>{var e;return(e=_.value)==null?void 0:e.deviceId},()=>{if(c.type==="device"){const e=_.value,a=`${e.parentId}/${e.deviceId}`;if(u.some(t=>t.path===a)&&!x)return H.warn("当前设备已在分屏中!");h({path:a,deviceItem:e},C.selectNum)}x=!1}),g(()=>_.value.path,e=>{const a=_.value;if(c.type==="stream"&&e){if(u.some(t=>t.path===a.path))return H.warn("当前设备流已在分屏中!");h({path:a.path,streamItem:a},C.selectNum)}}),(e,a)=>(s(),d("div",Y,[o.value?(s(),l(r(E),{key:0,type:"warning",message:"当前浏览器不支持 H265 解码",description:"如需观看 H265 视频请使用最新版的 Chrome 浏览器,确保显卡驱动已安装最新版本","show-icon":"",closable:"",class:"mb-12px",onClose:a[0]||(a[0]=t=>o.value=!1)})):k("",!0),(s(!0),d(D,null,M(r(u),t=>(s(),d("div",{class:"preview-box",key:t.path},["path"in t&&t.path?(s(),d(D,{key:0},[r($)?(s(),l(T,{key:0,path:t.path,stream:t.stream},{default:m(()=>[t.path?(s(),l(r(R),{key:0,class:"position-absolute bottom-0 left-50% cursor-pointer",title:t.path,getPopupContainer:p},{default:m(()=>[y(r(S),{icon:"octicon:ellipsis-16",size:20,color:"#dedede",hoverColor:"#a275d9"})]),_:2},1032,["title"])):k("",!0)]),_:2},1032,["path","stream"])):(s(),l(T,{key:1,format:"ws-flv",path:t.path,stream:t.stream},{default:m(()=>[t.path?(s(),l(r(R),{key:0,class:"position-absolute bottom-0 left-50% cursor-pointer",title:t.path,getPopupContainer:p},{default:m(()=>[y(r(S),{icon:"octicon:ellipsis-16",size:20,color:"#dedede",hoverColor:"#a275d9"})]),_:2},1032,["title"])):k("",!0)]),_:2},1032,["path","stream"]))],64)):(s(),d("div",Z,[y(r(R),{title:"当前无信号,请先选择通道",class:"no-stream-tip cursor-pointer",getPopupContainer:p,placement:"top"},{default:m(()=>[y(r(S),{icon:"pepicons-pop:television-play-off",size:i.value===1?50:24},null,8,["size"])]),_:1})]))]))),128))]))}});const K=J(j,[["__scopeId","data-v-a4fe5d47"]]),O=b({name:"Screen"}),oe=b({...O,setup(N){const c=new URLSearchParams(window.location.search),I=c.get("ID")||"",n=c.get("DeviceID")||"",i={ID:I,DeviceID:n},p=V(),w=o=>{const{parentId:v,deviceId:f,parentName:h,name:u}=o;p.setActiveInfo({parentId:v,deviceId:f,parentName:h,name:u})};return L(()=>{w(i)}),(o,v)=>(s(),l(K))}});export{oe as default};