From 943be925a838d5b9657396606b6aa50f4903810f Mon Sep 17 00:00:00 2001 From: optrader Date: Tue, 25 Nov 2025 22:58:25 +0900 Subject: [PATCH] [251125] fix: Memory Monitoring - 1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ๐Ÿ• ์ปค๋ฐ‹ ์‹œ๊ฐ„: 2025. 11. 25. 22:58:25 ๐Ÿ“Š ๋ณ€๊ฒฝ ํ†ต๊ณ„: โ€ข ์ด ํŒŒ์ผ: 2๊ฐœ โ€ข ์ถ”๊ฐ€: +20์ค„ โ€ข ์‚ญ์ œ: -26์ค„ ๐Ÿ“ ์ˆ˜์ •๋œ ํŒŒ์ผ: ~ com.twin.app.shoptime/src/components/VideoPlayer/VideoPlayer.js ~ com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx ๐Ÿ”ง ์ฃผ์š” ๋ณ€๊ฒฝ ๋‚ด์šฉ: โ€ข UI ์ปดํฌ๋„ŒํŠธ ์•„ํ‚คํ…์ฒ˜ ๊ฐœ์„  โ€ข ์ฝ”๋“œ ์ •๋ฆฌ ๋ฐ ์ตœ์ ํ™” Performance: ์ฝ”๋“œ ์ตœ์ ํ™”๋กœ ์„ฑ๋Šฅ ๊ฐœ์„  ๊ธฐ๋Œ€ --- .../src/components/VideoPlayer/VideoPlayer.js | 26 ------------------- .../src/views/PlayerPanel/PlayerPanel.jsx | 20 ++++++++++++++ 2 files changed, 20 insertions(+), 26 deletions(-) diff --git a/com.twin.app.shoptime/src/components/VideoPlayer/VideoPlayer.js b/com.twin.app.shoptime/src/components/VideoPlayer/VideoPlayer.js index c44826a3..ec5a46aa 100644 --- a/com.twin.app.shoptime/src/components/VideoPlayer/VideoPlayer.js +++ b/com.twin.app.shoptime/src/components/VideoPlayer/VideoPlayer.js @@ -1132,11 +1132,6 @@ const VideoPlayerBase = class extends React.Component { } // ๋ ˆํผ๋Ÿฐ์Šค๋„ ํ•ด์ œํ•ด GC ๋Œ€์ƒ์ด ๋˜๋„๋ก ํ•จ this.video = null; - // ๋ฉ”๋ชจ๋ฆฌ ๋ชจ๋‹ˆํ„ฐ๋ง ์ธํ„ฐ๋ฒŒ ์ •๋ฆฌ - if (this.memoryMonitoringInterval) { - clearInterval(this.memoryMonitoringInterval); - this.memoryMonitoringInterval = null; - } memoryMonitor.logMemory('[VideoPlayer] componentWillUnmount - cleanup done'); // console.log('[VideoPlayer] componentWillUnmount - cleanup done', { src: this.props?.src }); if (this.floatingLayerController) { @@ -1816,7 +1811,6 @@ const VideoPlayerBase = class extends React.Component { * @public */ play = () => { - console.log('[TEST] play() method called'); memoryMonitor.logMemory('[VideoPlayer] play() called', { currentTime: this.state.currentTime, duration: this.state.duration, @@ -1842,21 +1836,6 @@ const VideoPlayerBase = class extends React.Component { this.send('play'); this.announce($L('Play')); this.startDelayedMiniFeedbackHide(5000); - // ์žฌ์ƒ ์‹œ์ž‘ ์‹œ ์ •๊ธฐ์  ๋ฉ”๋ชจ๋ฆฌ ๋ชจ๋‹ˆํ„ฐ๋ง ์‹œ์ž‘ - if (!this.memoryMonitoringInterval) { - this.memoryMonitoringInterval = setInterval(() => { - try { - const mediaState = this.getMediaState(); - memoryMonitor.logMemory('[VideoPlayer] Playing', { - currentTime: (mediaState?.currentTime ?? 0).toFixed(2), - duration: (mediaState?.duration ?? 0).toFixed(2), - buffered: (this.state?.proportionLoaded ?? 0).toFixed(2), - }); - } catch (err) { - // ํƒ€์ด๋จธ ์‹คํ–‰ ์ค‘ ์˜ค๋ฅ˜ ๋ฐœ์ƒ ์‹œ ๋ฌด์‹œ - } - }, 30000); // 30์ดˆ๋งˆ๋‹ค ๋ฉ”๋ชจ๋ฆฌ ํ™•์ธ - } // Redux ์ƒํƒœ ์—…๋ฐ์ดํŠธ - ์žฌ์ƒ ์ƒํƒœ๋กœ ๋ณ€๊ฒฝ if (this.props.dispatch) { @@ -1905,11 +1884,6 @@ const VideoPlayerBase = class extends React.Component { this.send('pause'); this.announce($L('Pause')); this.stopDelayedMiniFeedbackHide(); - // ์žฌ์ƒ ์ผ์‹œ์ •์ง€ ์‹œ ์ •๊ธฐ์  ๋ฉ”๋ชจ๋ฆฌ ๋ชจ๋‹ˆํ„ฐ๋ง ์ค‘์ง€ - if (this.memoryMonitoringInterval) { - clearInterval(this.memoryMonitoringInterval); - this.memoryMonitoringInterval = null; - } // Redux ์ƒํƒœ ์—…๋ฐ์ดํŠธ - ์ผ์‹œ์ •์ง€ ์ƒํƒœ๋กœ ๋ณ€๊ฒฝ if (this.props.dispatch) { diff --git a/com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx b/com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx index fcfcb527..83d70067 100644 --- a/com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx +++ b/com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx @@ -380,6 +380,26 @@ const PlayerPanel = ({ isTabActivated, panelInfo, isOnTop, spotlightId, ...props } }, []); + // ์žฌ์ƒ ์ค‘ 15์ดˆ๋งˆ๋‹ค ๋ฉ”๋ชจ๋ฆฌ ๋ชจ๋‹ˆํ„ฐ๋ง + const lastMemoryLogTimeRef = useRef(0); + useEffect(() => { + const mediaState = videoPlayer.current?.getMediaState(); + + // ์žฌ์ƒ ์ค‘์ธ์ง€ ํ™•์ธ (duration > 0์ด๊ณ  paused๊ฐ€ ์•„๋‹˜) + if (mediaState?.duration > 0 && !mediaState?.paused && currentTime > 0) { + const now = Date.now(); + // ๋งˆ์ง€๋ง‰ ๋กœ๊ทธ ์ดํ›„ 15์ดˆ ์ด์ƒ ๊ฒฝ๊ณผํ–ˆ์œผ๋ฉด ๋กœ๊น… + if (now - lastMemoryLogTimeRef.current >= 15000) { + memoryMonitor.current.logMemory('[Video Playing]', { + currentTime: (mediaState?.currentTime ?? 0).toFixed(2), + duration: (mediaState?.duration ?? 0).toFixed(2), + buffered: (mediaState?.proportionLoaded ?? 0).toFixed(2), + }); + lastMemoryLogTimeRef.current = now; + } + } + }, [currentTime]); + // PlayerPanel.jsx์˜ ๋ผ์ธ 313-327 useEffect ์ˆ˜์ • - detailPanelClosed flag ๊ฐ์ง€ ์ถ”๊ฐ€ useEffect(() => { dlog('[PlayerPanel] ๐Ÿ” isOnTop useEffect ํ˜ธ์ถœ:', {