提交 c2ad5604 编写于 作者: haochangdi's avatar haochangdi

优化视频逻辑

上级 b902d2a0
......@@ -279,16 +279,16 @@ class RtcClient {
console.log(`${event.type} player is ${event.state}`);
// 远端流是播放还是暂停状态(显示按钮等画面不同)
if (event.type == 'video' && event.state == 'STOPPED') {
console.log('远端流为停止');
this.changeView(id, 'mask', true)
console.log(`${uid}----------远端流为停止`);
this.changeView(uid, 'mask', true)
}
if (event.type == 'video' && event.state == 'PAUSED') {
console.log('远端流为暂停');
this.changeView(id, 'mask', true)
console.log(`${uid}----------远端流为暂停`);
this.changeView(uid, 'mask', true)
}
if (event.type == 'video' && event.state == 'PLAYING') {
console.log('远端流为播放');
this.changeView(id, 'mask', false)
console.log(`${uid}----------远端流为播放`);
this.changeView(uid, 'mask', false)
}
});
......@@ -336,7 +336,7 @@ class RtcClient {
const remoteStream = evt.stream;
const id = remoteStream.getId();
const uid = remoteStream.userId_;
console.log('远程流被移除时触发');
console.log(`${uid}------------远程流被移除时触发`);
// 停止播放并删除相应<video>标签
remoteStream.stop();
this.inmembers_.delete(uid)
......@@ -402,7 +402,7 @@ class RtcClient {
remove(userId) {
for(let i = 0; i < this.viewslist.length; i++) {
if (this.viewslist[i] && this.viewslist[i].userId == userId) {
this.viewslist.splice(i, 1)
this.viewslist[i] = null
}
}
this.vueInstance.removeMember(userId)
......
......@@ -374,6 +374,7 @@ export default {
// client离开房间
leave() {
this.rtc.leave()
this.clearSession()
this.$router.go(-1)
},
// 结束会话
......@@ -440,16 +441,17 @@ export default {
clearInterval(this.answerTimeFn)
clearInterval(this.useTimeFn)
clearInterval(this.loseTimeFn)
},
// 清除直播时间相关的seession
clearSession() {
sessionStorage.removeItem('TIME_askTime')
sessionStorage.removeItem('TIME_answerTime')
sessionStorage.removeItem('TIME_useTime')
sessionStorage.removeItem('TIME_loseTime')
}
},
beforeDestroy() {
console.log('===========this.askTimeFn=========================');
console.log(this.askTimeFn);
console.log('====================================');
clearInterval(this.askTimeFn)
clearInterval(this.answerTimeFn)
clearInterval(this.useTimeFn)
clearInterval(this.loseTimeFn)
this.clearTime()
}
}
</script>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册