From 16718c47534b458f7b8a6f6699d255bc78ac01fc Mon Sep 17 00:00:00 2001 From: optrader Date: Wed, 12 Nov 2025 13:06:57 +0900 Subject: [PATCH] =?UTF-8?q?[251112]=20feat:=20views=20-=20ProductVideo.v2.?= =?UTF-8?q?jsx=20-=20=EA=B8=B0=EB=8A=A5=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit πŸ• 컀밋 μ‹œκ°„: 2025. 11. 12. 13:06:56 πŸ“Š λ³€κ²½ 톡계: β€’ 총 파일: 1개 β€’ μΆ”κ°€: +63쀄 β€’ μ‚­μ œ: -3쀄 πŸ“ μˆ˜μ •λœ 파일: ~ com.twin.app.shoptime/src/views/DetailPanel/ProductContentSection/ProductVideo/ProductVideo.v2.jsx πŸ”§ μ£Όμš” λ³€κ²½ λ‚΄μš©: β€’ μ†Œκ·œλͺ¨ κΈ°λŠ₯ κ°œμ„  --- .../ProductVideo/ProductVideo.v2.jsx | 66 ++++++++++++++++++- 1 file changed, 63 insertions(+), 3 deletions(-) diff --git a/com.twin.app.shoptime/src/views/DetailPanel/ProductContentSection/ProductVideo/ProductVideo.v2.jsx b/com.twin.app.shoptime/src/views/DetailPanel/ProductContentSection/ProductVideo/ProductVideo.v2.jsx index 152f7943..7afbd9e3 100644 --- a/com.twin.app.shoptime/src/views/DetailPanel/ProductContentSection/ProductVideo/ProductVideo.v2.jsx +++ b/com.twin.app.shoptime/src/views/DetailPanel/ProductContentSection/ProductVideo/ProductVideo.v2.jsx @@ -212,7 +212,14 @@ export function ProductVideoV2({ const handleBackButton = useCallback(() => { if (isFullscreen) { // 전체화면이면 일반 λͺ¨λ“œλ‘œ - // console.log('[BgVideo] ProductVideoV2 - Exiting fullscreen to normal mode'); + console.log('🎬 [handleBackButton] μ „μ²΄ν™”λ©΄μ—μ„œ 일반 λͺ¨λ“œλ‘œ μ „ν™˜'); + + // 🎬 VideoPlayerRef μƒνƒœ 확인 ν›„ μ „ν™˜ + if (videoPlayerRef.current) { + const mediaState = videoPlayerRef.current.getMediaState?.(); + console.log('🎬 [handleBackButton] μ „ν™˜ μ „ μƒνƒœ', mediaState); + } + setIsFullscreen(false); dispatch(switchToModal()); videoPlayerRef.current?.stopAutoCloseTimeout?.(); @@ -251,11 +258,35 @@ export function ProductVideoV2({ // 전체화면 ν† κΈ€ ν•Έλ“€λŸ¬ const toggleFullscreen = useCallback(() => { setIsFullscreen((prev) => { + const newFullscreen = !prev; + console.log('🎬 [toggleFullscreen] ν† κΈ€ μ‹€ν–‰', { prevIsFullscreen: prev, - newIsFullscreen: !prev, + newIsFullscreen: newFullscreen, }); - return !prev; + + // 🎬 VideoPlayerRefλ₯Ό ν†΅ν•œ 직접 μ œμ–΄λ‘œ 쀑간 μ§€μ—° κ°μ†Œ + if (videoPlayerRef.current) { + try { + const currentMediaState = videoPlayerRef.current.getMediaState?.(); + console.log('🎬 [toggleFullscreen] VideoPlayerRef ν˜„μž¬ μƒνƒœ', { + currentTime: currentMediaState?.currentTime, + paused: currentMediaState?.paused, + playbackRate: currentMediaState?.playbackRate, + newFullscreen, + }); + + // 전체화면 μ „ν™˜ μ „ ν˜„μž¬ μƒνƒœ μ €μž₯ (ν•„μš”μ‹œ) + if (currentMediaState && !currentMediaState.paused) { + // μž¬μƒ 쀑이라면 μƒνƒœ μœ μ§€λ₯Ό μœ„ν•œ 처리 + console.log('🎬 [toggleFullscreen] μž¬μƒ μƒνƒœ μœ μ§€ 처리'); + } + } catch (error) { + console.warn('🎬 [toggleFullscreen] VideoPlayerRef μ ‘κ·Ό 였λ₯˜:', error); + } + } + + return newFullscreen; }); }, []); @@ -507,6 +538,35 @@ export function ProductVideoV2({ }; }, [dispatch, isPlaying]); + // 🎬 전체화면 μ „ν™˜ μ‹œ VideoPlayerRef 직접 μ œμ–΄λ₯Ό ν†΅ν•œ 쀑간 μ§€μ—° κ°μ†Œ + useEffect(() => { + if (isPlaying && videoPlayerRef.current) { + console.log('🎬 [useEffect] 전체화면 μƒνƒœ λ³€κ²½ 감지', { + isFullscreen, + timestamp: Date.now(), + }); + + // μ•½κ°„μ˜ μ§€μ—° ν›„ VideoPlayer μƒνƒœ 확인 및 μ œμ–΄ + const timeoutId = setTimeout(() => { + if (videoPlayerRef.current) { + const mediaState = videoPlayerRef.current.getMediaState?.(); + console.log('🎬 [useEffect] 전체화면 μ „ν™˜ ν›„ VideoPlayer μƒνƒœ', { + isFullscreen, + mediaState, + }); + + // ν•„μš”μ‹œ μž¬μƒ μƒνƒœ μ¦‰μ‹œ 볡원 + if (mediaState && mediaState.paused && !mediaState.error) { + console.log('🎬 [useEffect] μž¬μƒ μƒνƒœ μ¦‰μ‹œ 볡원 μ‹œλ„'); + // videoPlayerRef.current.play(); + } + } + }, 100); // 100ms μ§€μ—°μœΌλ‘œ onStart() ν›„ μ œμ–΄ + + return () => clearTimeout(timeoutId); + } + }, [isFullscreen, isPlaying]); + // VideoContainer의 λͺ¨λ“  클릭 κ°μ‹œ (HooksλŠ” early return 전에 μ •μ˜λ˜μ–΄μ•Ό 함) const handleVideoContainerClick = useCallback( (e) => {