@@ -119,8 +119,11 @@ export default function VideoEditor() {
119119 fileName : string ;
120120 format : string ;
121121 } | null > ( null ) ;
122+ const [ isFullscreen , setIsFullscreen ] = useState ( false ) ;
122123
124+ const playerContainerRef = useRef < HTMLDivElement > ( null ) ;
123125 const videoPlaybackRef = useRef < VideoPlaybackRef > ( null ) ;
126+
124127 const nextZoomIdRef = useRef ( 1 ) ;
125128 const nextTrimIdRef = useRef ( 1 ) ;
126129 const nextSpeedIdRef = useRef ( 1 ) ;
@@ -539,6 +542,21 @@ export default function VideoEditor() {
539542 }
540543 }
541544
545+ const toggleFullscreen = useCallback ( ( ) => {
546+ setIsFullscreen ( ( prev ) => ! prev ) ;
547+ } , [ ] ) ;
548+
549+ useEffect ( ( ) => {
550+ if ( ! isFullscreen ) return ;
551+ const handleKeyDown = ( e : KeyboardEvent ) => {
552+ if ( e . key === "Escape" ) {
553+ setIsFullscreen ( false ) ;
554+ }
555+ } ;
556+ window . addEventListener ( "keydown" , handleKeyDown ) ;
557+ return ( ) => window . removeEventListener ( "keydown" , handleKeyDown ) ;
558+ } , [ isFullscreen ] ) ;
559+
542560 function handleSeek ( time : number ) {
543561 const video = videoPlaybackRef . current ?. video ;
544562 if ( ! video ) return ;
@@ -1425,7 +1443,14 @@ export default function VideoEditor() {
14251443 < PanelGroup direction = "vertical" className = "gap-3" >
14261444 { /* Top section: video preview and controls */ }
14271445 < Panel defaultSize = { 70 } maxSize = { 70 } minSize = { 40 } >
1428- < div className = "w-full h-full flex flex-col items-center justify-center bg-black/40 rounded-2xl border border-white/5 shadow-2xl overflow-hidden" >
1446+ < div
1447+ ref = { playerContainerRef }
1448+ className = {
1449+ isFullscreen
1450+ ? "fixed inset-0 z-[99999] w-full h-full flex flex-col items-center justify-center bg-[#09090b]"
1451+ : "w-full h-full flex flex-col items-center justify-center bg-black/40 rounded-2xl border border-white/5 shadow-2xl overflow-hidden relative"
1452+ }
1453+ >
14291454 { /* Video preview */ }
14301455 < div className = "w-full flex justify-center items-center flex-auto mt-1.5" >
14311456 < div
@@ -1487,6 +1512,8 @@ export default function VideoEditor() {
14871512 isPlaying = { isPlaying }
14881513 currentTime = { currentTime }
14891514 duration = { duration }
1515+ isFullscreen = { isFullscreen }
1516+ onToggleFullscreen = { toggleFullscreen }
14901517 onTogglePlayPause = { togglePlayPause }
14911518 onSeek = { handleSeek }
14921519 />
0 commit comments