|
@@ -5,7 +5,7 @@
|
|
|
-->
|
|
|
<template>
|
|
|
<div
|
|
|
- @keydown="props.listenWinEvents || handleVideoKeydown"
|
|
|
+ @keydown="handleVideoKeydown"
|
|
|
@mousemove="handleVideoMousemove"
|
|
|
class="videoPlay"
|
|
|
:class="{ isHideController: !isShowController }"
|
|
@@ -78,7 +78,7 @@ import { formatTime } from "./tools"
|
|
|
import { NSlider } from "naive-ui"
|
|
|
|
|
|
const props = defineProps<{
|
|
|
- listenWinEvents?: boolean
|
|
|
+ disableEvents?: boolean
|
|
|
}>()
|
|
|
const emits = defineEmits<{
|
|
|
(e: "ready"): void //播放器初始化完成
|
|
@@ -133,14 +133,8 @@ const isShowController = ref(true)
|
|
|
let _showTimer: any
|
|
|
onMounted(() => {
|
|
|
initVideo()
|
|
|
- if (props.listenWinEvents) {
|
|
|
- document.addEventListener("keydown", handleVideoKeydown)
|
|
|
- }
|
|
|
})
|
|
|
onUnmounted(() => {
|
|
|
- if (props.listenWinEvents) {
|
|
|
- document.removeEventListener("keydown", handleVideoKeydown)
|
|
|
- }
|
|
|
playerVm?.dispose()
|
|
|
})
|
|
|
/**
|
|
@@ -256,6 +250,7 @@ function handlePalySpeed(value: number) {
|
|
|
handlePalySpeedChange(palySpeed)
|
|
|
}
|
|
|
function handleVideoKeydown(e: KeyboardEvent) {
|
|
|
+ if (props.disableEvents) return
|
|
|
const key = e.key
|
|
|
if (key === " ") {
|
|
|
handlePlay()
|
|
@@ -267,6 +262,7 @@ function handleVideoKeydown(e: KeyboardEvent) {
|
|
|
}
|
|
|
/* 是否显示控制器 */
|
|
|
function handleVideoMousemove() {
|
|
|
+ if (props.disableEvents) return
|
|
|
showController()
|
|
|
}
|
|
|
function showController() {
|