From 89ff921aaac786ad95364579babfe14d288bf797 Mon Sep 17 00:00:00 2001 From: optrader Date: Tue, 25 Nov 2025 10:41:26 +0900 Subject: [PATCH] =?UTF-8?q?[251125]=20fix:=20VideoPlayer=20=EB=A9=94?= =?UTF-8?q?=EB=AA=A8=EB=A6=AC=EC=B5=9C=EC=A0=81=ED=99=94=20-=201?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ๐Ÿ• ์ปค๋ฐ‹ ์‹œ๊ฐ„: 2025. 11. 25. 10:41:26 ๐Ÿ“Š ๋ณ€๊ฒฝ ํ†ต๊ณ„: โ€ข ์ด ํŒŒ์ผ: 3๊ฐœ โ€ข ์ถ”๊ฐ€: +101์ค„ โ€ข ์‚ญ์ œ: -76์ค„ ๐Ÿ“ ์ˆ˜์ •๋œ ํŒŒ์ผ: ~ com.twin.app.shoptime/src/components/VideoPlayer/TReactPlayer.jsx ~ com.twin.app.shoptime/src/components/VideoPlayer/VideoPlayer.js ~ com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx ๐Ÿ”ง ์ฃผ์š” ๋ณ€๊ฒฝ ๋‚ด์šฉ: โ€ข UI ์ปดํฌ๋„ŒํŠธ ์•„ํ‚คํ…์ฒ˜ ๊ฐœ์„  โ€ข ์ค‘๊ฐ„ ๊ทœ๋ชจ ๊ธฐ๋Šฅ ๊ฐœ์„  โ€ข ์ฝ”๋“œ ์ •๋ฆฌ ๋ฐ ์ตœ์ ํ™” --- .../components/VideoPlayer/TReactPlayer.jsx | 29 +---- .../src/components/VideoPlayer/VideoPlayer.js | 122 ++++++++++++------ .../src/views/PlayerPanel/PlayerPanel.jsx | 28 ++-- 3 files changed, 102 insertions(+), 77 deletions(-) diff --git a/com.twin.app.shoptime/src/components/VideoPlayer/TReactPlayer.jsx b/com.twin.app.shoptime/src/components/VideoPlayer/TReactPlayer.jsx index c35e839c..183a1eda 100644 --- a/com.twin.app.shoptime/src/components/VideoPlayer/TReactPlayer.jsx +++ b/com.twin.app.shoptime/src/components/VideoPlayer/TReactPlayer.jsx @@ -155,33 +155,8 @@ export default function TReactPlayer({ return events; }, [handleEvent, mediaEventsMap]); - // ๐Ÿ”ฝ [์ตœ์ ํ™”] URL ๋ณ€๊ฒฝ ๋˜๋Š” ์–ธ๋งˆ์šดํŠธ ์‹œ ์ด์ „ ๋น„๋””์˜ค ์ •๋ฆฌ (๋ฉ”๋ชจ๋ฆฌ ๋ˆ„์ˆ˜ ๋ฐฉ์ง€) - useEffect(() => { - return () => { - // console.log('[TReactPlayer] cleanup - start', { url }); - const videoNode = playerRef.current?.getInternalPlayer(); - if (videoNode) { - try { - // VideoPlayer.js์—์„œ ์ด๋ฏธ ์ฒ˜๋ฆฌํ•˜๋ฏ€๋กœ ์ตœ์†Œํ•œ ์ •๋ฆฌ๋งŒ - if (videoNode.pause) { - videoNode.pause(); - } - // ์ค‘๋ณต ์ •๋ฆฌ ๋ฐฉ์ง€๋ฅผ ์œ„ํ•ด ์กฐ๊ฑด ๋” ์—„๊ฒฉํ•˜๊ฒŒ - if (typeof videoNode.stopVideo === 'function' && videoNode.stopVideo !== videoNode.pause) { - videoNode.stopVideo(); - } - // HLS ์ธ์Šคํ„ด์Šค๊ฐ€ ์กด์žฌํ•˜๋ฉด ๋ช…์‹œ์ ์œผ๋กœ ํŒŒ๊ดด - const hls = playerRef.current?.getInternalPlayer?.('hls'); - if (hls && typeof hls.destroy === 'function') { - hls.destroy(); - } - } catch (err) { - console.warn('[TReactPlayer] cleanup warning:', err); - } - } - // console.log('[TReactPlayer] cleanup - done', { url }); - }; - }, [url]); // โœ… URL ๋ณ€๊ฒฝ ์‹œ์—๋„ ์ •๋ฆฌ ๋กœ์ง ์‹คํ–‰ + // ๋ฉ”๋ชจ๋ฆฌ ์ •๋ฆฌ๋Š” VideoPlayer.js componentWillUnmount์—์„œ ์ˆ˜ํ–‰ + // TReactPlayer๋Š” react-player ๋ž˜ํผ ์—ญํ• ๋งŒ ์ˆ˜ํ–‰ return (