直播完成

This commit is contained in:
2020-10-30 09:54:39 +08:00
parent e0319762c9
commit 7a3ca8fb62
3 changed files with 30 additions and 4 deletions

View File

@@ -194,7 +194,7 @@ import { defineComponent, onMounted, ref } from "vue";
import LivePlaying from "@/components/LivePlaying.vue";
import LiveingWatcher from "@/components/LiveingWatcher.vue";
import TRTC from "trtc-js-sdk"
import { getliveinfo, usersig } from '@/api';
import { getliveinfo, livestop, luzhi, usersig } from '@/api';
import { useRoute } from 'vue-router';
import store from '@/store';
import { message } from 'ant-design-vue';
@@ -338,12 +338,15 @@ export default defineComponent({
remoteStream.play('s-' + remoteStream.userId_);
});
client
.join({ roomId: 12 })
.join({ roomId: roominfo.value.roomid})
.catch((error: string) => {
console.error('进房失败 ' + error);
})
.then(() => {
console.log('进房成功');
// if(typeof id == "string"){
luzhi(roominfo.value.roomid)
// }
fun()
});
}
@@ -374,7 +377,9 @@ export default defineComponent({
client.leave().then(() => {
// leaving room success
visible.value = false;
if(typeof id == "string"){
livestop(id, roominfo.value.roomid)
}
}).catch((error: string) => {
message.error('关闭失败: ' + error);
});