From 7baeca9432fe345a6cccef17b33f6a55ceab1d66 Mon Sep 17 00:00:00 2001 From: optrader Date: Tue, 25 Nov 2025 22:28:43 +0900 Subject: [PATCH] =?UTF-8?q?[251125]=20fix:=20PlayerPanel-VidoerPlayer?= =?UTF-8?q?=EC=B5=9C=EC=A0=81=ED=99=94-1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ๐Ÿ• ์ปค๋ฐ‹ ์‹œ๊ฐ„: 2025. 11. 25. 22:28:43 ๐Ÿ“Š ๋ณ€๊ฒฝ ํ†ต๊ณ„: โ€ข ์ด ํŒŒ์ผ: 2๊ฐœ โ€ข ์ถ”๊ฐ€: +30์ค„ โ€ข ์‚ญ์ œ: -10์ค„ ๐Ÿ“ ์ˆ˜์ •๋œ ํŒŒ์ผ: ~ com.twin.app.shoptime/src/components/VideoPlayer/VideoPlayer.js ~ com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx ๐Ÿ”ง ์ฃผ์š” ๋ณ€๊ฒฝ ๋‚ด์šฉ: โ€ข UI ์ปดํฌ๋„ŒํŠธ ์•„ํ‚คํ…์ฒ˜ ๊ฐœ์„  โ€ข ์†Œ๊ทœ๋ชจ ๊ธฐ๋Šฅ ๊ฐœ์„  --- .../src/components/VideoPlayer/VideoPlayer.js | 6 ++-- .../src/views/PlayerPanel/PlayerPanel.jsx | 34 ++++++++++++++----- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/com.twin.app.shoptime/src/components/VideoPlayer/VideoPlayer.js b/com.twin.app.shoptime/src/components/VideoPlayer/VideoPlayer.js index c460525b..f29d1b28 100644 --- a/com.twin.app.shoptime/src/components/VideoPlayer/VideoPlayer.js +++ b/com.twin.app.shoptime/src/components/VideoPlayer/VideoPlayer.js @@ -776,6 +776,7 @@ const VideoPlayerBase = class extends React.Component { this.sliderKnobProportion = 0; this.mediaControlsSpotlightId = props.spotlightId + '_mediaControls'; this.jumpButtonPressed = null; + this.focusTimer = null; // Re-render-necessary State this.state = { @@ -1038,6 +1039,7 @@ const VideoPlayerBase = class extends React.Component { this.stopDelayedTitleHide(); this.stopDelayedFeedbackHide(); this.stopDelayedMiniFeedbackHide(); + if (this.focusTimer) clearTimeout(this.focusTimer); this.announceJob.stop(); this.renderBottomControl.stop(); this.slider5WayPressJob.stop(); @@ -2603,11 +2605,11 @@ const VideoPlayerBase = class extends React.Component { this.showControls(); if (this.state.lastFocusedTarget) { - setTimeout(() => { + this.focusTimer = setTimeout(() => { Spotlight.focus(this.state.lastFocusedTarget); }); } else { - setTimeout(() => { + this.focusTimer = setTimeout(() => { Spotlight.focus(SpotlightIds.PLAYER_TAB_BUTTON); }); } diff --git a/com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx b/com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx index 58430c82..f12e9602 100644 --- a/com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx +++ b/com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx @@ -282,6 +282,7 @@ const PlayerPanel = ({ isTabActivated, panelInfo, isOnTop, spotlightId, ...props const watchIntervalLive = useRef(null); const watchIntervalVod = useRef(null); const watchIntervalMedia = useRef(null); + const timeoutRef = useRef(null); // useEffect(() => { // console.log("###videoLoaded", videoLoaded); // if (nowMenu) { @@ -619,7 +620,7 @@ const PlayerPanel = ({ isTabActivated, panelInfo, isOnTop, spotlightId, ...props if (lastFocusedTargetId) { // ShopNowContents๊ฐ€ ๋ Œ๋”๋ง๋  ๋•Œ๊นŒ์ง€ ๋Œ€๊ธฐ ํ›„ ํฌ์ปค์Šค ๋ณต์› - setTimeout(() => { + timeoutRef.current = setTimeout(() => { dlog('[PlayerPanel] ๐Ÿ” 800ms ํ›„ ํฌ์ปค์Šค ๋ณต์› ์‹œ๋„:', lastFocusedTargetId); Spotlight.focus(lastFocusedTargetId); }, 800); @@ -1147,7 +1148,7 @@ const PlayerPanel = ({ isTabActivated, panelInfo, isOnTop, spotlightId, ...props //๋”ฎ๋งํฌ๋กœ ํ”Œ๋ ˆ์ด์–ด ์ง„์ž… ํ›„ ์ด์ „๋ฒ„ํŠผ ํด๋ฆญ์‹œ if (panels.length === 1) { - setTimeout(() => { + timeoutRef.current = setTimeout(() => { Spotlight.focus(SpotlightIds.HOME_TBODY); }); } @@ -1685,7 +1686,7 @@ const PlayerPanel = ({ isTabActivated, panelInfo, isOnTop, spotlightId, ...props useEffect(() => { if (currentLiveTimeSeconds > liveTotalTime) { - setTimeout(() => { + timeoutRef.current = setTimeout(() => { dispatch(getMainLiveShow()); setShopNowInfo(''); dispatch( @@ -1694,8 +1695,21 @@ const PlayerPanel = ({ isTabActivated, panelInfo, isOnTop, spotlightId, ...props }) ); }, 3000); + + return () => { + if (timeoutRef.current) clearTimeout(timeoutRef.current); + }; } - }, [currentLiveTimeSeconds, liveTotalTime]); + }, [currentLiveTimeSeconds, liveTotalTime, dispatch, playListInfo, selectedIndex]); + + useEffect(() => { + return () => { + if (timeoutRef.current) clearTimeout(timeoutRef.current); + if (watchIntervalLive.current) clearInterval(watchIntervalLive.current); + if (watchIntervalVod.current) clearInterval(watchIntervalVod.current); + if (watchIntervalMedia.current) clearInterval(watchIntervalMedia.current); + }; + }, []); const mediainfoHandler = useCallback( (ev) => { @@ -1994,7 +2008,7 @@ const PlayerPanel = ({ isTabActivated, panelInfo, isOnTop, spotlightId, ...props const handlePopupClose = useCallback(() => { dispatch(setHidePopup()); - setTimeout(() => Spotlight.focus(SpotlightIds.PLAYER_SUBTITLE_BUTTON)); + timeoutRef.current = setTimeout(() => Spotlight.focus(SpotlightIds.PLAYER_SUBTITLE_BUTTON)); }, [dispatch]); const reactPlayerSubtitleConfig = useMemo(() => { if (isSubtitleActive && currentSubtitleBlob) { @@ -2324,7 +2338,7 @@ const PlayerPanel = ({ isTabActivated, panelInfo, isOnTop, spotlightId, ...props }) ); Spotlight.pause(); - setTimeout(() => { + timeoutRef.current = setTimeout(() => { Spotlight.resume(); dispatch(PanelActions.popPanel()); }, VIDEO_END_ACTION_DELAY); @@ -2332,7 +2346,7 @@ const PlayerPanel = ({ isTabActivated, panelInfo, isOnTop, spotlightId, ...props } if (panelInfoRef.current.shptmBanrTpNm === 'VOD') { Spotlight.pause(); - setTimeout(() => { + timeoutRef.current = setTimeout(() => { stopExternalPlayer(); if (panelInfoRef.current.modal) { // ๋ชจ๋‹ฌ ๋ชจ๋“œ์—์„œ๋Š” ์ข…๋ฃŒ ํ›„ ํ™”๋ฉด์„ ์œ ์ง€ํ•˜๊ณ  Back ์•„์ด์ฝ˜์œผ๋กœ ํฌ์ปค์Šค ์ด๋™ @@ -2582,7 +2596,7 @@ const PlayerPanel = ({ isTabActivated, panelInfo, isOnTop, spotlightId, ...props if (lastFocusedTargetId) { // ShopNowContents๊ฐ€ ๋ Œ๋”๋ง๋  ๋•Œ๊นŒ์ง€ ์ž ์‹œ ๋Œ€๊ธฐ ํ›„ ํฌ์ปค์Šค ๋ณต์› - setTimeout(() => { + timeoutRef.current = setTimeout(() => { dlog('[PlayerPanel] ๐Ÿ” 500ms ํ›„ ํฌ์ปค์Šค ๋ณต์› ์‹œ๋„:', lastFocusedTargetId); Spotlight.focus(lastFocusedTargetId); }, 500); @@ -2591,6 +2605,10 @@ const PlayerPanel = ({ isTabActivated, panelInfo, isOnTop, spotlightId, ...props // ํ•œ ๋ฒˆ ์ฒ˜๋ฆฌํ•œ ๋ณต๊ท€ ํ”Œ๋ž˜๊ทธ๋Š” ์ฆ‰์‹œ ํ•ด์ œํ•ด ์ค‘๋ณต ์˜ํ–ฅ์„ ๋ง‰๋Š”๋‹ค. prevIsTopPanelDetailFromPlayerRef.current = false; } + + return () => { + if (timeoutRef.current) clearTimeout(timeoutRef.current); + }; } }, [ isOnTop,