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