Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8709bfba2a | ||
|
|
7f5441a512 | ||
|
|
694ea85ed3 | ||
|
|
ef61a5bf73 | ||
|
|
74805aa829 | ||
|
|
5f79df1973 | ||
|
|
942b652e56 | ||
|
|
f24e790bd7 |
No files matched your search
@@ -63,6 +63,10 @@
|
||||
| [ ] | **[결정 필요]** 쇼츠 문구 검토: '소리 켜기'/'소리 끄기' (줄 제목은 없앰) | 화면 문구 규칙 | `frontend/src/b/Shorts.tsx` |
|
||||
| [ ] | 쇼츠를 올린 직후 목록 갱신(`ShortsService.refresh`) 부르기 — 지금은 워커가 07·12·18시 10분에만 받아 18시 넘어 올리면 다음 날 아침에 뜸. 자동 업로드면 끝난 뒤 호출, 손으로 올리면 관리자 갱신 API | 올리는 방식 확인 필요 | `backend/services/shorts_service.py`, `backend/worker_main.py` |
|
||||
| [ ] | 쇼츠 API 실패·빈 목록일 때 공유 링크로 들어오면 남색 빈 화면만 보임 — 그 영상 ID 하나라도 띄우거나 × 버튼·안내 문구 보이기 | 10/27 QA 실패 (`items` 가 비면 빈 div 만 그림) | `frontend/src/b/Shorts.tsx` |
|
||||
| [ ] | **[결정 필요]** 쇼츠 폰에서 유튜브 멈춤(\|\|) 버튼이 계속 남음 — 유튜브 플레이어 자체 버튼이라 코드로 못 지움. 우리 쇼츠 원본 mp4를 저장소에 올려 <video>로 틀지, 폰 연결해 유튜브로 더 시도할지 | 10/27 실기기 보고, 크롬·WebKit 흉내에선 재현 안 됨 | `frontend/src/b/Shorts.tsx` |
|
||||
| [ ] | 토스 ait 는 `feat/apps-in-toss` 브랜치(~/orca/workspaces/o2o-weather/main-3)에서 만들기 — main 에는 토스 로그인·웹뷰 자동재생·쇼츠 토스 처리가 없음. 최신 ait 20:03 콘솔 업로드 필요 | 10/27 main 에서 만든 ait 로 쇼츠가 멈춰 보임 | `~/orca/workspaces/o2o-weather/main-3/frontend/nalssigak.ait` |
|
||||
| [ ] | 운영 행사 주소(event.address) 채우기 — 팝가가 연속 요청을 막아(429) 로컬도 206개 중 80개만. 간격 두고 다시 | 10/27 주소 수집 추가 | `backend/scheduler/jobs.py` `refresh_popups` |
|
||||
| [ ] | `test_watch_summary_flags_thunder_within_2_hours` 가 전체로 돌릴 때만 실패(따로 돌리면 통과) — 순서 의존 원인 찾기 | 10/27 전체 테스트 | `backend/tests/test_watch.py` |
|
||||
| [ ] | 쇼츠 자동재생 아이폰 사파리 실기기 확인 — 소리 꺼도 자동재생을 막는다는 보고 있음 | 헤드리스 크롬에서만 확인 | `frontend/src/b/Shorts.tsx` |
|
||||
| [x] | 단풍 명소 `남이섬`이 두 번 들어감(절정 10-25·10-27) — 10-27(화목원) 쪽 지움, 67곳 | 10/27 전체 점검 | `frontend/seo/foliage_2026.json` |
|
||||
| [x] | 날짜 따라 깨지던 테스트 2개 — 노을 칸은 그날 해 지는 시각으로, 방위각은 한 해 범위(240~300°)로 확인 | 10/27 전체 점검 | `backend/tests/test_weather_today.py`, `backend/tests/test_sky_api.py` |
|
||||
|
||||
+42
-23
@@ -50,7 +50,7 @@ function embed(id: string) {
|
||||
return `${YT_ORIGIN}/embed/${id}?${q}`
|
||||
}
|
||||
|
||||
type Func = 'playVideo' | 'pauseVideo' | 'seekTo' | 'mute' | 'unMute'
|
||||
type Func = 'playVideo' | 'seekTo' | 'mute' | 'unMute'
|
||||
|
||||
/** 이미 띄운 플레이어에 명령 (IFrame API 메시지) */
|
||||
function command(frame: HTMLIFrameElement | null | undefined, func: Func, args: unknown[] = []) {
|
||||
@@ -106,16 +106,35 @@ export function ShortsRail() {
|
||||
}
|
||||
|
||||
function ShortCard({ s, playing }: { s: ShortItem; playing: boolean }) {
|
||||
// 재생이 시작된 뒤에만 플레이어를 보인다: 자동재생이 막히면(아이폰 절전 등) 유튜브 재생 버튼 대신 표지 그대로
|
||||
const [started, setStarted] = useState(false)
|
||||
const frame = useRef<HTMLIFrameElement>(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 (
|
||||
<Link to={`/shorts/${s.id}`} aria-label={`${s.title} 보기`} className="relative block aspect-[9/16] w-[120px] cursor-pointer overflow-hidden rounded-xl bg-[#1d2233] p-0 text-left text-white">
|
||||
<img src={`https://i.ytimg.com/vi/${s.id}/hqdefault.jpg`} alt="" loading="lazy" className="absolute inset-0 size-full object-cover" />
|
||||
{playing && (
|
||||
<iframe
|
||||
ref={frame}
|
||||
src={embed(s.id)}
|
||||
title={s.title}
|
||||
allow="autoplay; encrypted-media; picture-in-picture"
|
||||
tabIndex={-1}
|
||||
className="pointer-events-none absolute top-1/2 left-1/2 border-0"
|
||||
// 재생 상태를 받으려면 플레이어에 먼저 '듣고 있다'고 알린다
|
||||
onLoad={(e) => e.currentTarget.contentWindow?.postMessage(JSON.stringify({ event: 'listening', id: s.id }), YT_ORIGIN)}
|
||||
className={cx('pointer-events-none absolute top-1/2 left-1/2 border-0 transition-opacity duration-200', !started && 'opacity-0')}
|
||||
style={{ width: PLAYER_W, height: (PLAYER_W * 16) / 9, transform: `translate(-50%, -50%) scale(${SCALE})` }}
|
||||
/>
|
||||
)}
|
||||
@@ -162,19 +181,27 @@ function ShortsViewer({ items, start, onClose, onAt }: { items: ShortItem[]; sta
|
||||
const frames = useRef(new Map<number, HTMLIFrameElement>())
|
||||
const atRef = useRef(start)
|
||||
const soundRef = useRef(false)
|
||||
// 누르기로 멈춘 상태. 다른 영상으로 넘어가면 다시 재생 중으로
|
||||
const paused = useRef(false)
|
||||
|
||||
// 처음 한 번: 시작 영상으로 맞추고, 뒤 페이지 스크롤을 잠근다
|
||||
const startRef = useRef(start)
|
||||
useEffect(() => {
|
||||
// scrollIntoView 는 바깥 칸까지 굴려 버튼 줄이 헤더 밑으로 숨으므로 목록만 옮긴다
|
||||
// 시작 영상으로 옮기기 전엔 보이는 칸이 바뀐 것으로 치지 않는다 (사파리는 처음 그릴 때 맨 위 칸이 먼저 보여 첫 영상으로 바뀌던 것)
|
||||
const placed = useRef(false)
|
||||
useLayoutEffect(() => {
|
||||
// scrollIntoView 는 바깥 칸까지 굴려 버튼 줄이 헤더 밑으로 숨으므로 목록만 옮긴다. 사파리는 첫 그림 전에 옮긴 값을 되돌려 한 번 더
|
||||
const box = list.current
|
||||
if (box) box.scrollTop = box.clientHeight * startRef.current
|
||||
const place = () => {
|
||||
if (box) box.scrollTop = box.clientHeight * startRef.current
|
||||
}
|
||||
place()
|
||||
const raf = requestAnimationFrame(() => {
|
||||
place()
|
||||
placed.current = true
|
||||
})
|
||||
const root = document.documentElement
|
||||
const before = root.style.overflow
|
||||
root.style.overflow = 'hidden'
|
||||
return () => {
|
||||
cancelAnimationFrame(raf)
|
||||
root.style.overflow = before
|
||||
}
|
||||
}, [])
|
||||
@@ -190,6 +217,7 @@ function ShortsViewer({ items, start, onClose, onAt }: { items: ShortItem[]; sta
|
||||
if (!box) return
|
||||
const io = new IntersectionObserver(
|
||||
(entries) => {
|
||||
if (!placed.current) return
|
||||
for (const e of entries) if (e.isIntersecting) setAt(Number((e.target as HTMLElement).dataset.i))
|
||||
},
|
||||
{ root: box, threshold: 0.6 },
|
||||
@@ -198,7 +226,7 @@ function ShortsViewer({ items, start, onClose, onAt }: { items: ShortItem[]; sta
|
||||
return () => io.disconnect()
|
||||
}, [])
|
||||
|
||||
// 미리 띄운 영상이 재생되기 시작하면(첫 장면을 받음) 보이는 영상이 아닐 때 멈추고 처음으로
|
||||
// 플레이어가 재생을 시작하면(첫 장면을 받음) 보이게 한다. 앞뒤 영상은 멈추지 않는다: 멈췄다 다시 틀면 유튜브가 재생·멈춤 버튼을 영상 위에 띄운다
|
||||
useEffect(() => {
|
||||
const onMessage = (e: MessageEvent) => {
|
||||
if (e.origin !== YT_ORIGIN || typeof e.data !== 'string') return
|
||||
@@ -212,9 +240,6 @@ function ShortsViewer({ items, start, onClose, onAt }: { items: ShortItem[]; sta
|
||||
for (const [i, f] of frames.current) {
|
||||
if (f.contentWindow !== e.source) continue
|
||||
setReady((r) => (r.has(i) ? r : new Set(r).add(i)))
|
||||
if (i === atRef.current) continue
|
||||
command(f, 'pauseVideo')
|
||||
command(f, 'seekTo', [0, true])
|
||||
}
|
||||
}
|
||||
window.addEventListener('message', onMessage)
|
||||
@@ -225,27 +250,21 @@ function ShortsViewer({ items, start, onClose, onAt }: { items: ShortItem[]; sta
|
||||
useEffect(() => {
|
||||
if (atRef.current !== at) moved(items[at])
|
||||
atRef.current = at
|
||||
paused.current = false
|
||||
// 앞뒤 영상은 소리 없이 계속 돌고 있으니, 넘어온 영상만 처음부터 다시 틀고 소리를 맞춘다 (멈춤 명령은 쓰지 않는다)
|
||||
for (const [i, f] of frames.current) {
|
||||
if (i === at) {
|
||||
command(f, 'seekTo', [0, true])
|
||||
command(f, soundRef.current ? 'unMute' : 'mute')
|
||||
command(f, 'playVideo')
|
||||
} else {
|
||||
command(f, 'pauseVideo')
|
||||
command(f, 'mute')
|
||||
}
|
||||
} else command(f, 'mute')
|
||||
}
|
||||
}, [at, items])
|
||||
|
||||
// 마우스로도 끌어 넘긴다: 영상 위는 유튜브 iframe 이 마우스를 가져가서, 그 위에 투명한 판을 깔고 끈 만큼 목록을 옮긴다.
|
||||
// 손가락은 브라우저 스크롤에 맡기고, 끌지 않고 누르기만 하면 재생·일시정지
|
||||
// 손가락은 브라우저 스크롤에 맡기고, 끌지 않고 누르기만 하면 릴스처럼 소리 켜기·끄기 (멈추면 유튜브 버튼이 떠서)
|
||||
const drag = useRef<{ y: number; top: number; moved: boolean } | null>(null)
|
||||
const lastPointer = useRef('')
|
||||
const [dragging, setDragging] = useState(false)
|
||||
const togglePause = () => {
|
||||
paused.current = !paused.current
|
||||
command(frames.current.get(atRef.current), paused.current ? 'pauseVideo' : 'playVideo')
|
||||
}
|
||||
const onPointerDown = (e: ReactPointerEvent<HTMLDivElement>) => {
|
||||
lastPointer.current = e.pointerType
|
||||
const box = list.current
|
||||
@@ -268,7 +287,7 @@ function ShortsViewer({ items, start, onClose, onAt }: { items: ShortItem[]; sta
|
||||
drag.current = null
|
||||
setDragging(false)
|
||||
if (!d || !box) return
|
||||
if (!d.moved) return togglePause()
|
||||
if (!d.moved) return toggleSound()
|
||||
// 30px 만 끌어도 다음·이전 영상으로, 그보다 덜 끌면 제자리로
|
||||
const h = box.clientHeight
|
||||
const dy = e.clientY - d.y
|
||||
@@ -355,7 +374,7 @@ function ShortsViewer({ items, start, onClose, onAt }: { items: ShortItem[]; sta
|
||||
drag.current = null
|
||||
setDragging(false)
|
||||
}}
|
||||
onClick={() => lastPointer.current !== 'mouse' && togglePause()}
|
||||
onClick={() => lastPointer.current !== 'mouse' && toggleSound()}
|
||||
className={cx('absolute inset-0 touch-pan-y select-none', dragging ? 'cursor-grabbing' : 'cursor-grab')}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user