diff --git a/src/views/regime/Liveing.vue b/src/views/regime/Liveing.vue index 03c0252..7dd269d 100644 --- a/src/views/regime/Liveing.vue +++ b/src/views/regime/Liveing.vue @@ -239,45 +239,6 @@ export default defineComponent({ }); } - async function pingmu(){ - const result = await TRTC.checkSystemRequirements() - console.log(result,11111) - if(!result) { - message.error("您的浏览器不支持屏幕分享,请下载新版chrome"); - return ; - } - - localStream = TRTC.createStream({ userid: store.state.userinfo.memberid, audio: true, screen: true }); - const id = localStream.getId(); - await localStream - .initialize() - .catch((error: string) => { - console.error('初始化本地流失败 ' + error); - message.error("请选择分享的内容") - - setTimeout(()=>{ - pingmu() - }, 1000) - }) - .then(() => { - console.log('初始化本地流成功'); - client - .publish(localStream) - .catch((error: string) => { - console.log('本地流发布失败 ' + error); - - }) - .then(() => { - const el = document.querySelector("#local_stream"); - if(el){ - el.innerHTML = "" - } - localStream.play('local_stream'); - console.log('本地流发布成功'); - console.log(id , 123) - }); - }); - } async function shexiang(){ localStream = TRTC.createStream({ userId: store.state.userinfo.memberid, audio: true, video: true }); const id = localStream.getId(); @@ -304,6 +265,48 @@ export default defineComponent({ }); }); } + + async function pingmu(){ + const result = await TRTC.checkSystemRequirements() + console.log(result,11111) + if(!result) { + message.error("您的浏览器不支持屏幕分享,请下载新版chrome"); + shexiang() + return ; + } + + localStream = TRTC.createStream({ userid: store.state.userinfo.memberid, audio: true, screen: true }); + const id = localStream.getId(); + await localStream + .initialize() + .catch((error: string) => { + console.error('初始化本地流失败 ' + error); + message.error("请选择分享的内容") + + setTimeout(()=>{ + shexiang() + }, 1000) + }) + .then(() => { + console.log('初始化本地流成功'); + client + .publish(localStream) + .catch((error: string) => { + console.log('本地流发布失败 ' + error); + + }) + .then(() => { + const el = document.querySelector("#local_stream"); + if(el){ + el.innerHTML = "" + } + localStream.play('local_stream'); + console.log('本地流发布成功'); + console.log(id , 123) + }); + }); + } + async function init(fun: any, userSig: string): Promise{ console.log(userSig) const el = document.querySelector("#local_stream");