@@ -48,6 +48,7 @@ import useBoolean from '../hooks/useBoolean'
4848import useMount from '../hooks/useMount'
4949import useHandler from '../hooks/useHandler'
5050import usePlayerShortcuts from './usePlayerShortcuts'
51+
5152const CONTROLLER_HIDE_DELAY = 3000
5253
5354// 被 Provider 包装后的属性
@@ -138,7 +139,7 @@ const InnerPlayer: React.FC<InnerPlayerProps> = ({
138139} ) => {
139140 const { emitEvent, subscribeAction} = useContext ( InternalMessageContext )
140141 const { currentSrc} = useContext ( VideoSourceContext )
141- const rootRef = useRef < HTMLDivElement > ( null )
142+ const [ root , setRoot ] = useState < HTMLDivElement | null > ( null )
142143 const videoRef = useRef < {
143144 root : HTMLVideoElement
144145 seek ( currentTime : number ) : void
@@ -368,7 +369,7 @@ const InnerPlayer: React.FC<InnerPlayerProps> = ({
368369 const onExit = ( ) => {
369370 return emitEvent ( EVENTS . EXIT_FULLSCREEN )
370371 }
371- BigScreen ?. toggle ( rootRef . current ! , onEnter , onExit )
372+ BigScreen ?. toggle ( root ! , onEnter , onExit )
372373 }
373374 } )
374375
@@ -463,6 +464,7 @@ const InnerPlayer: React.FC<InnerPlayerProps> = ({
463464 } )
464465
465466 usePlayerShortcuts ( {
467+ root,
466468 prevVolumeRef,
467469 isPlaying,
468470 volume,
@@ -603,7 +605,9 @@ const InnerPlayer: React.FC<InnerPlayerProps> = ({
603605 onMouseDown = { handleMouseDown }
604606 onMouseUp = { handleMouseUp }
605607 onMouseMove = { handleShowController }
606- ref = { rootRef }
608+ ref = { setRoot }
609+ tabIndex = { - 1 }
610+ aria-label = { title }
607611 >
608612 < div className = { css ( styles . video ) } >
609613 < Video
0 commit comments