视频一直加载中 重新渲染

merge-requests/1/head
dydwang 4 years ago
parent cdcca5137f
commit 2b7b88e727

@ -10,7 +10,6 @@
<link href="/video_play_plugins/video-js-cdn.min.css" rel="stylesheet">
<script src="/video_play_plugins/video.js"></script>
<script src="/video_play_plugins/videojs-contrib-hls.min.js"></script>
<title>垛机视觉系统</title>
</head>

File diff suppressed because one or more lines are too long

@ -8,6 +8,10 @@
@playing="onPlayerPlaying"
@timeupdate="onPlayerTimeupdate"
@ended="onPlayerEnded"
@error="onError"
@emptied="onEmptied"
@statechanged="playerStateChanged"
@loadeddata="onPlayerLoadeddata"
/>
</template>
@ -29,6 +33,8 @@ export default {
},
data() {
return {
timer: null, //
currentTime: 0, //
showVideo: true,
isPlay: false, //
playerOptions: {
@ -68,28 +74,64 @@ export default {
onPlayerPause() {
this.isPlay && this.$emit('showModel');
// this.isPlay = false;
console.log('onPlayerPause');
},
//
onPlayerPlaying(...args) {
this.isPlay = true;
console.log('onPlayerPlaying');
},
//
onPlayerEnded($event) {
this.isPlay = false;
console.log('onPlayerEnded');
},
onTimer() {
this.timer && clearTimeout(this.timer);
this.timer = setTimeout(() => {
this.onloadVideo();
}, 8 * 1000)
},
onloadVideo() {
console.log('重新加载了');
const videoRef = this.$refs['video-player'];
console.log(videoRef);
this.showVideo = false;
this.$nextTick(() => {
this.showVideo = true;
})
},
onError(data) {
console.log('onError');
console.log(data);
},
onEmptied(data) {
console.log('onEmptied');
console.log(data);
},
onPlayerLoadeddata($event) {
console.log('onPlayerLoadeddata')
},
playerStateChanged(playerCurrentState) {
//
if(playerCurrentState.waiting) {
// this.onTimer();
}else {
this.timer && clearTimeout(this.timer);
}
// console.log('player current update state', playerCurrentState)
},
//
onPlayerTimeupdate($event) {
//
const bufferedEnd = $event.bufferedEnd();
//
const currentTime = $event.currentTime();
//
const differTime = bufferedEnd - currentTime
//
if(differTime > 60) {
this.showVideo = false;
this.$nextTick(() => {
this.showVideo = true;
})
}
this.currentTime = currentTime;
// this.onTimer();
//
const differTime = bufferedEnd - currentTime;
}
}
}
@ -107,5 +149,9 @@ export default {
.vjs-control-bar {
display: none !important;
}
//
.vjs-loading-spinner {
// display: none;
}
}
</style>

Loading…
Cancel
Save