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 && (