直播完成

This commit is contained in:
luyuan 2020-10-30 09:54:39 +08:00
parent e0319762c9
commit 7a3ca8fb62
Signed by: theluyuan
GPG Key ID: A7972FD973317FF3
3 changed files with 30 additions and 4 deletions

View File

@ -967,4 +967,25 @@ export async function livestart(id: string) {
}else{ }else{
message.error(res.msg) message.error(res.msg)
} }
} }
export async function livestop(id: string, roomid: string) {
const res = await put("live/" + id, {status : 2})
if(res.code == 0){
message.success(res.msg)
}else{
message.error(res.msg)
}
const luzhi = await get('StopMCUMixTranscode', {roomid});
console.log(luzhi)
}
export async function luzhi(roomid: string){
const res = await get('StartMCUMixTranscode', {roomid});
console.log(res)
}
// export async function StopMCUMixTranscode(roomid: number) {
// const res = await get('StopMCUMixTranscode', {roomid});
// console.log(res)
// }

View File

@ -15,7 +15,7 @@
</div> </div>
<div class="takehour" v-if="i.status == 1 && livestatus == 2"> <div class="takehour" v-if="i.status == 1 && livestatus == 2">
参加时长 参加时长
<div>30min</div> <div>{{i.length}}min</div>
</div> </div>
<div <div
class="cancel" class="cancel"

View File

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