播放视频调整

This commit is contained in:
joylink_zhaoerwei 2024-03-21 16:57:58 +08:00
parent 7971fce1b6
commit 6e6737a7c6

View File

@ -6,7 +6,7 @@
:playsinline="false" :playsinline="false"
:options="playOptions" :options="playOptions"
@play="onPlayerPlay($event)" @play="onPlayerPlay($event)"
@timeupdate="onPlayerTimeupdate($event)" @pause="onPlayerPause($event)"
/> />
</div> </div>
</el-dialog> </el-dialog>
@ -69,6 +69,7 @@ export default {
}); });
}, },
handleClose() { handleClose() {
this.$refs.videoPlayer.player.pause();
this.dialogVisible = false; this.dialogVisible = false;
}, },
onPlayerPlay(player) { onPlayerPlay(player) {
@ -89,14 +90,6 @@ export default {
}, },
onPlayerPause(player) { onPlayerPause(player) {
this.playedTime = player.currentTime(); this.playedTime = player.currentTime();
},
onPlayerTimeupdate(player) {
const timeDisplay = player.currentTime();
if (timeDisplay - this.currentTime > 1) {
player.currentTime(this.currentTime > this.maxTime ? this.currentTime : this.maxTime);
}
this.currentTime = player.currentTime();
this.maxTime = this.currentTime > this.maxTime ? this.currentTime : this.maxTime;
} }
} }
}; };