File tree Expand file tree Collapse file tree 5 files changed +49
-46
lines changed Expand file tree Collapse file tree 5 files changed +49
-46
lines changed File renamed without changes.
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import Hls from 'hls.js';
3
3
import styled from 'styled-components' ;
4
4
5
5
import playerLoading from '@assets/player_loading.gif' ;
6
- import CustomPlayIcon from '@assets/custom_play_icon.svg' ;
6
+ import CustomPlayIcon from '@assets/icons/ custom_play_icon.svg' ;
7
7
import PauseIcon from '@assets/icons/pause_icon.svg' ;
8
8
import PlayIcon from '@assets/icons/play_icon.svg' ;
9
9
@@ -58,14 +58,37 @@ const Player = ({ videoUrl }: { videoUrl: string }) => {
58
58
}
59
59
} ;
60
60
61
+ useEffect ( ( ) => {
62
+ const handleKeyDown = ( e : KeyboardEvent ) => {
63
+ if ( e . code === 'Space' ) {
64
+ e . preventDefault ( ) ;
65
+ handlePlayPause ( ) ;
66
+ }
67
+ } ;
68
+
69
+ const videoElement = videoRef . current ;
70
+ videoElement ?. addEventListener ( 'keydown' , handleKeyDown ) ;
71
+
72
+ return ( ) => {
73
+ videoElement ?. removeEventListener ( 'keydown' , handleKeyDown ) ;
74
+ } ;
75
+ } , [ ] ) ;
76
+
61
77
return (
62
78
< PlayerContainer $onHLSReady = { onHLSReady } >
63
79
< LivePlayerInner >
64
80
{ onHLSReady ? (
65
81
< >
66
- < Video ref = { videoRef } controls onClick = { handlePlayPause } />
82
+ < Video
83
+ ref = { videoRef }
84
+ controls
85
+ onClick = { handlePlayPause }
86
+ tabIndex = { 0 } // Video 요소가 포커스를 받을 수 있도록 설정
87
+ />
67
88
{ showIcon && (
68
- < IconOverlay $isFullscreen = { isFullscreen } > { isPaused ? < PlayIcon /> : < PauseIcon /> } </ IconOverlay >
89
+ < IconOverlay $isFullscreen = { isFullscreen } >
90
+ { isPaused ? < PlayIcon /> : < PauseIcon /> }
91
+ </ IconOverlay >
69
92
) }
70
93
</ >
71
94
) : (
You can’t perform that action at this time.
0 commit comments