From b240ecb1801755aa02716f87aa88246de210afb0 Mon Sep 17 00:00:00 2001 From: Mina Choi Date: Mon, 26 Oct 2026 16:33:50 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=ED=86=A0=EC=8A=A4=ED=8C=90=20=EC=87=BC?= =?UTF-8?q?=EC=B8=A0=EB=8A=94=20=EC=9C=A0=ED=8A=9C=EB=B8=8C=20=EA=B8=B0?= =?UTF-8?q?=EB=B3=B8=20=ED=94=8C=EB=A0=88=EC=9D=B4=EC=96=B4=EB=A1=9C=20?= =?UTF-8?q?=EC=9E=90=EB=8F=99=EC=9E=AC=EC=83=9D=20=E2=80=94=20=ED=86=A0?= =?UTF-8?q?=EC=8A=A4=20=EC=9B=B9=EB=B7=B0=EC=97=94=20=ED=94=8C=EB=A0=88?= =?UTF-8?q?=EC=9D=B4=EC=96=B4=20=EC=9E=AC=EC=83=9D=20=EC=83=81=ED=83=9C?= =?UTF-8?q?=EA=B0=80=20=EC=95=88=20=EC=99=80=EC=84=9C=20=EC=88=A8=EA=B8=B0?= =?UTF-8?q?=EA=B8=B0=C2=B7=EB=AA=85=EB=A0=B9=C2=B7=EC=9E=AC=EC=83=9D=20?= =?UTF-8?q?=EC=95=84=EC=9D=B4=EC=BD=98=EC=9D=84=20=EC=93=B0=EC=A7=80=20?= =?UTF-8?q?=EC=95=8A=EA=B3=A0,=20=EC=86=8C=EB=A6=AC=20=EC=BC=A0=20?= =?UTF-8?q?=EC=B1=84=20=EC=9E=AC=EC=83=9D(=EB=A7=89=ED=9E=88=EB=A9=B4=20?= =?UTF-8?q?=EC=9C=A0=ED=8A=9C=EB=B8=8C=20=EC=9E=AC=EC=83=9D=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC),=20=EB=84=98=EA=B8=B0=EA=B8=B0=EB=8A=94=20=EC=9D=B4?= =?UTF-8?q?=EC=A0=84=C2=B7=EB=8B=A4=EC=9D=8C=20=EB=B2=84=ED=8A=BC.=20?= =?UTF-8?q?=EC=9B=B9=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 --- TODO.md | 1 + frontend/src/b/Shorts.tsx | 111 ++++++++------------------------------ 2 files changed, 23 insertions(+), 89 deletions(-) diff --git a/TODO.md b/TODO.md index faf635f..7fd7f8d 100644 --- a/TODO.md +++ b/TODO.md @@ -236,6 +236,7 @@ | [ ] | **[결정 필요]** 토스 연결 끊기 처리 — 지금은 UNLINK·탈퇴 모두 토큰만 무효로 함. 토스 탈퇴(`WITHDRAWAL_TOSS`·`WITHDRAWAL_TERMS`) 때 계정·댓글을 지울지 | 토스 로그인 구현(10/14) | `backend/services/auth_service.py` | | [ ] | 토스 로그인 문구 검토 — '토스로 로그인', '토스로 로그인했어요', '토스 로그인을 마치지 못했어요. 한 번 더 눌러 주세요.', 기본 닉네임 '토스1234'(userKey 끝 4자리), 로그인 창 '날씨각 로그인'·'로그인하면 동네 이야기를 쓰고 내 각을 저장할 수 있어요' | 토스 로그인 구현(10/14) | `frontend/src/b/Sheets.tsx`, `backend/services/auth_service.py` | | [ ] | 메뉴의 '로그인하면 좋아요·댓글을 쓸 수 있어요' — 좋아요·댓글은 로그인 없이 됨(10/21 결정)이라 문구가 틀림 | 인트로 추가 중 발견 (10/24) | `frontend/src/b/Sheets.tsx:1117` | +| [ ] | 토스 웹뷰에서 유튜브 플레이어가 보내는 재생 상태(postMessage)가 페이지에 오지 않음 — 원인 미확인(origin 불일치? 토스 브리지?). 그래서 토스판 쇼츠는 숨기기·명령 없이 유튜브 기본 플레이어 사용. 원인 찾으면 웹과 같은 UI로 합칠 수 있음 | 토스판 쇼츠 재생 안 됨 (10/26) | `frontend/src/b/Shorts.tsx` | | [ ] | 댓글 신고·차단 — 앱인토스 필수 아님(신고·차단 필수는 채팅·만남·중고거래만, 서비스 오픈 정책·서비스별 주의사항). 만들지 않기로 함(10/14). 검수에서 요청이 오면 만든다 | 토스 로그인 구현(10/14) | | | [x] | 각 늘리기 53→68 — 리서치로 고른 8개(한강·놀이공원·데이트·곱슬머리·보일러·선크림·모기·테니스) + 감성 7개(효도·감사·선물·파티·게임·셀카·센치), 아이콘 15개(Codex) | 사용자 요청 (10/20, 리서치 https://claude.ai/artifact/3ZQbtGKRLVZViRRC5voBzY) | `backend/seed/index_definition.json`, `frontend/public/icons/`, `frontend/src/b/lib.ts` | | [ ] | **[결정 필요]** 한강각·놀이공원각이 강·놀이공원 없는 동네에도 나옴 — 각을 지역별로 가려 보여 주는 기능이 없음(한강밤바람각도 같음). 서울·한강 인접 구만 보일지 | 새 각 추가 중 발견 (10/20) | `backend/seed/index_definition.json`, `backend/services/index_service.py` | diff --git a/frontend/src/b/Shorts.tsx b/frontend/src/b/Shorts.tsx index ce435e5..bfbf95f 100644 --- a/frontend/src/b/Shorts.tsx +++ b/frontend/src/b/Shorts.tsx @@ -31,12 +31,13 @@ function useTabBarHeight() { const YT_ORIGIN = 'https://www.youtube-nocookie.com' -// 토스 웹뷰에서는 플레이어가 보내는 재생 상태가 오지 않아, 숨기기·자동재생 없이 유튜브 기본 플레이어(재생 버튼 포함)를 그대로 쓴다 +// 토스 웹뷰에는 플레이어가 보내는 재생 상태가 오지 않아, 쇼츠 페이지는 플레이어를 숨기거나 명령하지 않고 유튜브 기본 조작(재생 버튼)과 소리를 켠 채 그대로 보인다. +// 영상 위 터치는 유튜브가 가져가므로 넘기기는 버튼으로 const PLAIN = IS_TOSS -function embed(id: string) { +function embed(id: string, plain = false) { const q = new URLSearchParams({ - autoplay: PLAIN ? '0' : '1', mute: PLAIN ? '0' : '1', playsinline: '1', loop: '1', playlist: id, controls: PLAIN ? '1' : '0', rel: '0', modestbranding: '1', + autoplay: '1', mute: plain ? '0' : '1', playsinline: '1', loop: '1', playlist: id, controls: plain ? '1' : '0', rel: '0', modestbranding: '1', enablejsapi: '1', origin: window.location.origin, }) return `${YT_ORIGIN}/embed/${id}?${q}` @@ -50,25 +51,6 @@ function command(frame: HTMLIFrameElement | null | undefined, func: Func, args: } const PLAYING = 1 -const BUFFERING = 3 -// 이만큼 지나도 재생되지 않으면(자동재생이 막힌 웹뷰) 재생 아이콘을 띄운다 -const STALL_MS = 2000 -// 아이콘을 눌러 보낸 재생 명령도 이만큼 안에 재생이 안 되면 웹뷰가 막은 것 → 플레이어를 직접 누르게 한다 -const DIRECT_MS = 1500 - -/** 플레이어가 보낸 재생 상태 (onStateChange·infoDelivery). 없으면 undefined */ -function playerState(e: MessageEvent): number | undefined { - if (e.origin !== YT_ORIGIN || typeof e.data !== 'string') return undefined - try { - const msg = JSON.parse(e.data) as { event?: string; info?: number | { playerState?: number } } - if (msg.event === 'onStateChange' && typeof msg.info === 'number') return msg.info - return typeof msg.info === 'object' ? msg.info?.playerState : undefined - } catch { - return undefined - } -} - -const isRunning = (state: number | undefined) => state === PLAYING || state === BUFFERING // 마우스로 이만큼 끌면 다음·이전 영상으로 넘긴다 const SWIPE_PX = 30 @@ -108,7 +90,7 @@ export function ShortsRail() {
{items.map((s, i) => ( - + ))}
@@ -116,29 +98,11 @@ export function ShortsRail() { } function ShortCard({ s, playing }: { s: ShortItem; playing: boolean }) { - const frame = useRef(null) - const [state, setState] = useState() - useEffect(() => { - if (!playing) return - const onMessage = (e: MessageEvent) => { - if (e.source !== frame.current?.contentWindow) return - const next = playerState(e) - if (next !== undefined) setState(next) - } - window.addEventListener('message', onMessage) - return () => window.removeEventListener('message', onMessage) - }, [playing]) - return ( {playing && (