修正完了error

This commit is contained in:
2020-10-22 11:04:04 +08:00
parent 854ce7191c
commit ff85285fb4
22 changed files with 303 additions and 295 deletions

View File

@@ -204,52 +204,7 @@ export default defineComponent({
let localStream: any;
let statie = true;
let userSing = '';
onMounted(async ()=>{
userSing = await usersig(10);
init(pingmu, userSing);
})
function fenxiang(){
console.log(localStream)
// client.unpublish(localStream).then(() => {
// // 关闭屏幕分享流
// console.log("关闭")
// client.leave().then(() => {
// // leaving room success
// console.log("关闭成功")
// }).catch((error: string) => {
// console.error('leaving room failed: ' + error);
// });
// });
init(statie ? shexiang : pingmu, userSing);
statie = !statie;
}
function init(fun: any, userSig: string){
console.log(userSig)
const el = document.querySelector("#local_stream");
if(el){
el.innerHTML = ""
}
client = TRTC.createClient({
mode: 'rtc',
sdkAppId: '1400400340',
userId: 10,
userSig: userSig
});
client
.join({ roomId: 11 })
.catch((error: string) => {
console.error('进房失败 ' + error);
})
.then(() => {
console.log('进房成功');
fun()
});
}
function pingmu(){
function pingmu(){
localStream = TRTC.createStream({ userid: 10, audio: true, screen: true });
localStream
@@ -290,6 +245,53 @@ export default defineComponent({
});
});
}
function init(fun: any, userSig: string){
console.log(userSig)
const el = document.querySelector("#local_stream");
if(el){
el.innerHTML = ""
}
client = TRTC.createClient({
mode: 'rtc',
sdkAppId: '1400400340',
userId: 10,
userSig: userSig
});
client
.join({ roomId: 11 })
.catch((error: string) => {
console.error('进房失败 ' + error);
})
.then(() => {
console.log('进房成功');
fun()
});
}
function fenxiang(){
console.log(localStream)
// client.unpublish(localStream).then(() => {
// // 关闭屏幕分享流
// console.log("关闭")
// client.leave().then(() => {
// // leaving room success
// console.log("关闭成功")
// }).catch((error: string) => {
// console.error('leaving room failed: ' + error);
// });
// });
init(statie ? shexiang : pingmu, userSing);
statie = !statie;
}
onMounted(async ()=>{
userSing = await usersig(10);
init(pingmu, userSing);
})
return{
fenxiang
}