diff --git a/frontend/src/b/Shorts.tsx b/frontend/src/b/Shorts.tsx index fb7b0d8..ce435e5 100644 --- a/frontend/src/b/Shorts.tsx +++ b/frontend/src/b/Shorts.tsx @@ -3,6 +3,7 @@ import { type CSSProperties, type PointerEvent as ReactPointerEvent, useEffect, import { Link, useNavigate, useParams } from 'react-router' import { listShortsOptions } from '@nalssigak/shared/api/client/@tanstack/react-query.gen' import type { ShortItem } from '@nalssigak/shared/api/client' +import { IS_TOSS } from '../lib/platform' import { cx } from '../lib/utils' import { Rail, Skel, SkelRail, TAP44 } from './ui' @@ -30,9 +31,12 @@ function useTabBarHeight() { const YT_ORIGIN = 'https://www.youtube-nocookie.com' +// 토스 웹뷰에서는 플레이어가 보내는 재생 상태가 오지 않아, 숨기기·자동재생 없이 유튜브 기본 플레이어(재생 버튼 포함)를 그대로 쓴다 +const PLAIN = IS_TOSS + function embed(id: string) { const q = new URLSearchParams({ - autoplay: '1', mute: '1', playsinline: '1', loop: '1', playlist: id, controls: '0', rel: '0', modestbranding: '1', + autoplay: PLAIN ? '0' : '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}` @@ -104,7 +108,7 @@ export function ShortsRail() {
{items.map((s, i) => ( - + ))}
@@ -314,6 +318,11 @@ function ShortsViewer({ items, start, onClose, onAt }: { items: ShortItem[]; sta box.scrollTo({ top: target * h, behavior: 'smooth' }) } + const go = (step: number) => { + const box = list.current + if (box) box.scrollTo({ top: (at + step) * box.clientHeight, behavior: 'smooth' }) + } + const toggleSound = () => { const on = !sound soundRef.current = on @@ -342,16 +351,27 @@ function ShortsViewer({ items, start, onClose, onAt }: { items: ShortItem[]; sta - + {PLAIN ? ( +
+ + +
+ ) : ( + + )}
{items.map((s, i) => (
- {Math.abs(i - at) <= 1 && ( + {(PLAIN ? i === at : Math.abs(i - at) <= 1) && (