播放视频调整

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"
:options="playOptions"
@play="onPlayerPlay($event)"
@timeupdate="onPlayerTimeupdate($event)"
@pause="onPlayerPause($event)"
/>
</div>
</el-dialog>
@ -69,6 +69,7 @@ export default {
});
},
handleClose() {
this.$refs.videoPlayer.player.pause();
this.dialogVisible = false;
},
onPlayerPlay(player) {
@ -89,14 +90,6 @@ export default {
},
onPlayerPause(player) {
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;
}
}
};