From d38cfc7229b04ae8a1e1f376d9aecf8a2692c298 Mon Sep 17 00:00:00 2001 From: Mina Choi Date: Tue, 27 Oct 2026 19:30:15 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=87=BC=EC=B8=A0=20=EC=BD=94=EB=93=9C?= =?UTF-8?q?=EB=A5=BC=20=ED=86=A0=EC=8A=A4=ED=8C=90=EA=B3=BC=20=EA=B0=99?= =?UTF-8?q?=EA=B2=8C=20=E2=80=94=20=ED=86=A0=EC=8A=A4=EB=8F=84=20=EC=95=9E?= =?UTF-8?q?=EB=92=A4=20=EB=AF=B8=EB=A6=AC=20=EB=B0=9B=EA=B8=B0=C2=B7?= =?UTF-8?q?=EC=86=8C=EB=A6=AC=20=EC=97=86=EC=9D=B4=20=EC=9E=90=EB=8F=99?= =?UTF-8?q?=EC=9E=AC=EC=83=9D,=20=EC=9E=AC=EC=83=9D=20=EC=8B=A0=ED=98=B8?= =?UTF-8?q?=EA=B0=80=20=EC=95=88=20=EC=98=A4=EB=8A=94=20=ED=86=A0=EC=8A=A4?= =?UTF-8?q?=EB=A7=8C=201=EC=B4=88=20=EB=92=A4=20=EC=98=81=EC=83=81?= =?UTF-8?q?=EC=9D=84=20=EB=B3=B4=EC=9E=84=20(=EC=9B=B9=20=EB=8F=99?= =?UTF-8?q?=EC=9E=91=EC=9D=80=20=EA=B7=B8=EB=8C=80=EB=A1=9C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/b/Shorts.tsx | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/frontend/src/b/Shorts.tsx b/frontend/src/b/Shorts.tsx index 8281394..a383554 100644 --- a/frontend/src/b/Shorts.tsx +++ b/frontend/src/b/Shorts.tsx @@ -37,6 +37,11 @@ function useTabBarHeight() { const YT_ORIGIN = 'https://www.youtube-nocookie.com' +// 토스 웹뷰에는 플레이어가 보내는 재생 상태가 오지 않는다. 그래서 토스는 첫 장면이 나왔는지를 시간으로 보고 표지를 걷는다 (나머지는 웹과 같다) +const PLAIN = IS_TOSS +// 토스는 재생 상태가 안 오므로, 플레이어 문서가 뜨고 이만큼 지나면 첫 장면이 나왔다고 보고 표지를 걷는다 (그 전엔 플레이어의 검은 화면 대신 표지) +const PLAIN_SHOW_MS = 1000 + function embed(id: string) { const q = new URLSearchParams({ autoplay: '1', mute: '1', playsinline: '1', loop: '1', playlist: id, controls: '0', rel: '0', modestbranding: '1', @@ -147,6 +152,13 @@ function ShortsViewer({ items, start, onClose, onAt }: { items: ShortItem[]; sta const tabH = useTabBarHeight() // 첫 장면을 받은 플레이어. 그 전엔 플레이어의 검은 화면 대신 표지를 보인다 const [ready, setReady] = useState>(new Set()) + // 토스: 표지를 걷은 플레이어들. 다음 영상도 미리 띄워 두므로 여럿 + const [plainShown, setPlainShown] = useState>(new Set()) + const plainTimers = useRef(new Set()) + useEffect(() => { + const timers = plainTimers.current + return () => timers.forEach((t) => window.clearTimeout(t)) + }, []) const frames = useRef(new Map()) const atRef = useRef(start) const soundRef = useRef(false) @@ -303,8 +315,8 @@ function ShortsViewer({ items, start, onClose, onAt }: { items: ShortItem[]; sta
- {/* 웹은 앞뒤 영상까지 미리 띄워 넘길 때 깜빡이지 않게, 토스 앱은 무거워 지금 영상 하나만 */} - {(IS_TOSS ? i === at : Math.abs(i - at) <= 1) && ( + {/* 릴스처럼 앞뒤 영상을 소리 없이 미리 받아 둔다 */} + {Math.abs(i - at) <= 1 && (