视频完成

This commit is contained in:
luyuan 2020-11-26 15:24:25 +08:00
parent be129457d6
commit 15d188886a
Signed by: theluyuan
GPG Key ID: A7972FD973317FF3

View File

@ -1,6 +1,7 @@
<template>
<div class="video">
<video :id=" 'a' + time" style="width:100%;height:100%"></video>
<video v-if="isvideo" :id=" 'a' + time" style="width:100%;height:100%"></video>
<img v-else :src="info.img" style="width:100%;height:100%" alt="">
<div class="liveinfo">
<div class="left">
<div>
@ -90,7 +91,7 @@
import { livestart } from '@/api';
import router from '@/router';
import { useI18n } from '@/utils/i18n';
import { defineComponent, onUpdated, ref } from "vue";
import { defineComponent, onUpdated, ref, watch } from "vue";
import { onBeforeRouteLeave } from 'vue-router';
export default defineComponent({
@ -116,19 +117,28 @@ export default defineComponent({
}
const time = ref(new Date().getTime())
let play: any;
onUpdated(()=>{
// console.log(props.url)
if(props.info){
play = window.TCPlayer('a' + time.value, {
fileID: (props.info.livestatus == 0 ? props.info.fileid : props.info.vodid),
appID: '1303872925'
});
const isvideo = ref(true);
watch(()=> props.info,()=>{
if(props.info){
console.log(props.info)
if(props.info.fileid != '0' || props.info.vodid != ''){
play = window.TCPlayer('a' + time.value, {
fileID: (props.info.livestatus == 0 ? props.info.fileid : props.info.vodid),
appID: '1303872925'
});
}else{
isvideo.value = false;
}
}
})
onBeforeRouteLeave((to, from, next) => {
console.log(121)
play.dispose()
if(play){
play.dispose()
}
next()
})
// const liveinfo = ref(props.liveinfo)
@ -136,7 +146,8 @@ export default defineComponent({
bianji,
kaishi,
lan,
time
time,
isvideo
}
}
});