From dbaedafb0bd9e8c78bf87742687d08c6d8b57766 Mon Sep 17 00:00:00 2001 From: "sungjin.choi" Date: Fri, 4 Dec 2026 10:05:32 +0900 Subject: [PATCH] =?UTF-8?q?feat=20:=20=EC=9E=90=EB=A3=8C=EC=8B=A4=20?= =?UTF-8?q?=EC=98=81=EC=83=81=20=EC=9E=90=EB=8F=99=20=EC=9E=AC=EC=83=9D?= =?UTF-8?q?=C2=B7=EB=B0=98=EB=B3=B5,=202=EB=B0=B0=EC=86=8D=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC,=20=EB=8D=94=EB=B8=94=20=ED=83=AD=205=EC=B4=88=20?= =?UTF-8?q?=EB=84=98=EA=B8=B0=EA=B8=B0,=20=ED=95=99=EC=8A=B5=EB=85=B8?= =?UTF-8?q?=ED=8A=B8=2020~22?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- src/features/bbs/components/MediaDetail.tsx | 39 ++++++++++- src/features/bbs/components/bbs.module.css | 5 ++ study-notes.md | 75 +++++++++++++++++++++ 3 files changed, 117 insertions(+), 2 deletions(-) diff --git a/src/features/bbs/components/MediaDetail.tsx b/src/features/bbs/components/MediaDetail.tsx index f836cd4..ebe12da 100644 --- a/src/features/bbs/components/MediaDetail.tsx +++ b/src/features/bbs/components/MediaDetail.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState, type FormEvent } from "react"; +import { useEffect, useRef, useState, type FormEvent, type TouchEvent } from "react"; import { API_URL, deleteMediaPost, fetchMediaPost, updateMediaPost } from "../api"; import type { MediaPost } from "../types"; import { bar, STATUS } from "./MediaList"; @@ -16,6 +16,38 @@ const formatSize = (bytes: number) => { return `${i === 0 ? n : n.toFixed(1)}${units[i]}`; }; +/** 모바일 더블 탭: 화면 왼쪽 절반 = 5초 뒤로, 오른쪽 절반 = 5초 앞으로 (아래쪽 재생 버튼 줄은 제외) */ +const seekOnDoubleTap = (e: TouchEvent) => { + const v = e.currentTarget; + const touch = e.changedTouches[0]; + const rect = v.getBoundingClientRect(); + if (touch.clientY > rect.bottom - 60) return; // 컨트롤 바 연타는 무시 + const last = Number(v.dataset.lastTap ?? 0); + v.dataset.lastTap = String(e.timeStamp); + if (e.timeStamp - last > 300) return; // 첫 번째 탭 + e.preventDefault(); // 브라우저 기본 더블 탭 동작(확대·전체화면 등) 막기 + v.dataset.lastTap = "0"; // 세 번 연타가 두 번 넘기지 않게 + v.currentTime = Math.max(0, v.currentTime + (touch.clientX - rect.left < rect.width / 2 ? -5 : 5)); +}; + +/** 영상 + 오른쪽 위 2배속 버튼 (누를 때마다 1x ↔ 2x). 전체화면에서는 버튼이 안 보임 → 브라우저 ⋮ 메뉴 사용 */ +const Video = ({ src, autoPlay }: { src: string; autoPlay: boolean }) => { + const ref = useRef(null); + const [fast, setFast] = useState(false); + const toggle = () => { + if (ref.current) ref.current.playbackRate = fast ? 1 : 2; + setFast(!fast); + }; + return ( +
+
+ ); +}; + /** 자료실 글 보기: 파일마다