import{_ as s,aI as e,U as i,c as t,P as o,aJ as n,f as a,aK as r,o as d}from"./index-Dlz9sh1M.js";const h=s({data:()=>({url:"",wv:"",isHost:!1,groupId:null,inviterId:null,userInfos:[]}),methods:{onMessage(s){this.onWebviewMessage(s.detail.data[0])},onInsertMessage(s){},onWebviewMessage(s){switch(console.log("来自webview的消息:"+JSON.stringify(s)),s.key){case"WV_READY":this.initWebView();break;case"WV_CLOSE":e();break;case"INSERT_MESSAGE":this.onInsertMessage(s.data)}},sendMessageToWebView(s,e){if(!this.wv)return void setTimeout((()=>this.sendMessageToWebView(s,e)),100);let i={key:s,data:e};this.wv.postMessage(i,"*")},initWebView(){this.wv=document.getElementById("chat-video-wv").contentWindow},initUrl(){this.url="/hybrid/html/rtc-group/index.html?",this.url+="baseUrl="+i.BASE_URL,this.url+="&groupId="+this.groupId,this.url+="&userId="+this.userStore.userInfo.id,this.url+="&inviterId="+this.inviterId,this.url+="&isHost="+this.isHost,this.url+="&loginInfo="+JSON.stringify(t("loginInfo")),this.url+="&userInfos="+JSON.stringify(this.userInfos),this.url+="&config="+JSON.stringify(this.configStore.webrtc)}},onBackPress(){console.log("onBackPress"),this.sendMessageToWebView("NAV_BACK",{})},onLoad(s){o("WS_RTC_GROUP",(s=>{this.sendMessageToWebView("RTC_MESSAGE",s)})),window.onmessage=s=>{this.onWebviewMessage(s.data.data.arg)},this.isHost=JSON.parse(s.isHost),this.inviterId=s.inviterId,this.groupId=s.groupId,this.userInfos=JSON.parse(decodeURIComponent(s.userInfos)),this.initUrl()},onUnload(){n("WS_RTC_GROUP")}},[["render",function(s,e,i,t,o,n){const h=r;return d(),a(h,{class:"page chat-group-video",id:"chat-video-wv",onMessage:n.onMessage,src:o.url},null,8,["onMessage","src"])}],["__scopeId","data-v-f8ea9552"]]);export{h as default};
