From 942b652e56de712e9c7a3d6056fda40dd32e5a2d Mon Sep 17 00:00:00 2001 From: Mina Choi Date: Tue, 27 Oct 2026 19:45:41 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=98=A4=EB=8A=98=20=ED=99=94=EB=A9=B4?= =?UTF-8?q?=20=EC=87=BC=EC=B8=A0=20=EC=A4=84=20=EC=B2=AB=20=EC=B9=B4?= =?UTF-8?q?=EB=93=9C=EB=8F=84=20=EC=9E=AC=EC=83=9D=EC=9D=B4=20=EC=8B=9C?= =?UTF-8?q?=EC=9E=91=EB=90=9C=20=EB=92=A4=EC=97=90=EB=A7=8C=20=EC=98=81?= =?UTF-8?q?=EC=83=81=EC=9D=84=20=EB=B3=B4=EC=9E=84=20=E2=80=94=20=EC=9E=90?= =?UTF-8?q?=EB=8F=99=EC=9E=AC=EC=83=9D=EC=9D=B4=20=EB=A7=89=ED=9E=88?= =?UTF-8?q?=EB=A9=B4=20=EC=9C=A0=ED=8A=9C=EB=B8=8C=20=EC=9E=AC=EC=83=9D=20?= =?UTF-8?q?=EB=B2=84=ED=8A=BC=20=EB=8C=80=EC=8B=A0=20=ED=91=9C=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/b/Shorts.tsx | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/frontend/src/b/Shorts.tsx b/frontend/src/b/Shorts.tsx index a383554..d48ed29 100644 --- a/frontend/src/b/Shorts.tsx +++ b/frontend/src/b/Shorts.tsx @@ -106,16 +106,35 @@ export function ShortsRail() { } function ShortCard({ s, playing }: { s: ShortItem; playing: boolean }) { + // 재생이 시작된 뒤에만 플레이어를 보인다: 자동재생이 막히면(아이폰 절전 등) 유튜브 재생 버튼 대신 표지 그대로 + const [started, setStarted] = useState(false) + const frame = useRef(null) + useEffect(() => { + if (!playing) return + const onMessage = (e: MessageEvent) => { + if (e.origin !== YT_ORIGIN || typeof e.data !== 'string' || e.source !== frame.current?.contentWindow) return + try { + if ((JSON.parse(e.data) as { info?: { playerState?: number } }).info?.playerState === PLAYING) setStarted(true) + } catch { + return + } + } + window.addEventListener('message', onMessage) + return () => window.removeEventListener('message', onMessage) + }, [playing]) return ( {playing && (