From 9674448865bb2e22f8ff88f0876ffec700654391 Mon Sep 17 00:00:00 2001 From: optrader Date: Mon, 24 Nov 2025 18:19:59 +0900 Subject: [PATCH] =?UTF-8?q?[251124]=20fix:=20PlayerPanel,VideoPlayer=20?= =?UTF-8?q?=EC=B5=9C=EC=A0=81=ED=99=94-5=20HLS=20=EB=B2=84=ED=8D=BC?= =?UTF-8?q?=EA=B8=B8=EC=9D=B4=20=EB=8A=98=EC=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ๐Ÿ• ์ปค๋ฐ‹ ์‹œ๊ฐ„: 2025. 11. 24. 18:19:58 ๐Ÿ“Š ๋ณ€๊ฒฝ ํ†ต๊ณ„: โ€ข ์ด ํŒŒ์ผ: 1๊ฐœ โ€ข ์ถ”๊ฐ€: +48์ค„ โ€ข ์‚ญ์ œ: -10์ค„ ๐Ÿ“ ์ˆ˜์ •๋œ ํŒŒ์ผ: ~ com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx ๐Ÿ”ง ์ฃผ์š” ๋ณ€๊ฒฝ ๋‚ด์šฉ: โ€ข ์†Œ๊ทœ๋ชจ ๊ธฐ๋Šฅ ๊ฐœ์„  --- .../src/views/PlayerPanel/PlayerPanel.jsx | 58 +++++++++++++++---- 1 file changed, 48 insertions(+), 10 deletions(-) diff --git a/com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx b/com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx index b586cf4b..fe07a672 100644 --- a/com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx +++ b/com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx @@ -2005,11 +2005,11 @@ const PlayerPanel = ({ isTabActivated, panelInfo, isOnTop, spotlightId, ...props }, tracks: [{ kind: 'subtitles', src: currentSubtitleBlob, default: true }], hlsOptions: { - // ๋ฒ„ํผ ๊ธธ์ด ์ถ•์†Œ๋กœ ๋ฉ”๋ชจ๋ฆฌ ์‚ฌ์šฉ ์™„ํ™” - maxBufferLength: 10, - maxMaxBufferLength: 30, - liveSyncDuration: 5, - liveMaxLatencyDuration: 10, + // ๋ฒ„ํผ ๊ธธ์ด๋ฅผ ์•ฝ๊ฐ„ ๋Š˜๋ ค ์žฌ๋ฒ„ํผ๋ง ๊ฐ์†Œ + maxBufferLength: 30, + maxMaxBufferLength: 90, + liveSyncDuration: 8, + liveMaxLatencyDuration: 16, }, }, youtube: YOUTUBECONFIG, @@ -2019,10 +2019,10 @@ const PlayerPanel = ({ isTabActivated, panelInfo, isOnTop, spotlightId, ...props youtube: YOUTUBECONFIG, file: { hlsOptions: { - maxBufferLength: 10, - maxMaxBufferLength: 30, - liveSyncDuration: 5, - liveMaxLatencyDuration: 10, + maxBufferLength: 30, + maxMaxBufferLength: 90, + liveSyncDuration: 8, + liveMaxLatencyDuration: 16, }, }, }; @@ -2222,11 +2222,15 @@ const PlayerPanel = ({ isTabActivated, panelInfo, isOnTop, spotlightId, ...props useEffect(() => { return () => { + console.log('[PlayerPanel] unmount cleanup start'); + cleanupPlayerOnUnmount(); + stopExternalPlayer(); dispatch(clearShopNowInfo()); dispatch(CLEAR_PLAYER_INFO()); setShopNowInfo([]); + console.log('[PlayerPanel] unmount cleanup done'); }; - }, []); + }, [cleanupPlayerOnUnmount, stopExternalPlayer, dispatch]); const focusBackToPanel = useCallback(() => { // ํฌ์ปค์Šค๋ฅผ PlayerPanel ์ชฝ์œผ๋กœ ๊ฐ•์ œ ์ด๋™ํ•ด YouTube iframe์ด ํฌ์ปค์Šค๋ฅผ ๊ฐ€์ ธ๊ฐ€๋Š” ๊ฒƒ์„ ์ฐจ๋‹จ @@ -2265,6 +2269,40 @@ const PlayerPanel = ({ isTabActivated, panelInfo, isOnTop, spotlightId, ...props } }, []); + // PlayerPanel ์–ธ๋งˆ์šดํŠธ ์‹œ ๋น„๋””์˜ค ์ž์› ๊ฐ•์ œ ํ•ด์ œ (popPanel ์‹œ์ ) + const cleanupPlayerOnUnmount = useCallback(() => { + const playerInstance = videoPlayer.current; + const media = playerInstance?.video; + + try { + playerInstance?.pause?.(); + playerInstance?.stopVideo?.(); + } catch (err) { + // ignore + } + + if (media) { + try { + media.pause?.(); + media.stopVideo?.(); + media.seekTo?.(0); + if ('currentTime' in media) { + media.currentTime = 0; + } + if ('src' in media) { + media.src = ''; + media.removeAttribute?.('src'); + } + if ('srcObject' in media) { + media.srcObject = null; + } + media.load?.(); + } catch (err) { + // ignore + } + } + }, []); + const onEnded = useCallback( (e) => { if (panelInfoRef.current.shptmBanrTpNm === 'MEDIA') {