From bdd6ef679b1a8565fe071d6e4beefe16eec2e40b Mon Sep 17 00:00:00 2001 From: WEP-56 <1484413790@qq.com> Date: Wed, 4 Nov 2026 11:19:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=90=83=E7=93=9C=E6=94=B9=E7=BD=91?= =?UTF-8?q?=E9=A1=B5=E5=BC=8F=E6=B5=8F=E8=A7=88=20+=20=E9=9F=B3=E9=87=8F?= =?UTF-8?q?=E8=BD=A8=E9=81=93=E5=AF=B9=E9=BD=90=20+=20=E6=A1=8C=E9=9D=A2?= =?UTF-8?q?=E9=97=B2=E7=BD=AE=E9=9A=90=E8=97=8F=20UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 分类/吃瓜列表点击直接进图文详情页(不再走播放器) - 图文正文按净化后的 HTML 渲染;图片地址补全绝对路径、优先取 data-src,修复图片加载不出 - 桌面播放器闲置 2.8s 淡出控制条/右侧操作栏/信息区,鼠标移动恢复 - 音量:轨道与滑块单独绘制并对齐;换源后重新套用音量/倍速,切集不再丢音量 - 移动端:栈页隐藏底栏(评论抽屉输入框不再被遮挡);横屏视频在首页保持黑边,沉浸模式才旋转横屏 --- src/App.tsx | 7 ++++-- src/components/Feed.tsx | 26 ++++++++++++++++++--- src/components/VideoSurface.tsx | 26 +++++++++++++++++++-- src/html.ts | 40 ++++++++++++++++++++++++++++++--- src/index.css | 30 ++++++++++++++++++++++--- src/pages/Category.tsx | 2 +- src/pages/Posts.tsx | 11 ++++++--- 7 files changed, 125 insertions(+), 17 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 76d02a2..167f4a6 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -103,6 +103,9 @@ function AppBody() { const vis = (k: Tab) => (tab === k ? "absolute inset-0" : "absolute inset-0 invisible pointer-events-none"); const pageActive = stack.length === 0 && !loginOpen; const bottomInset = platform === "android" ? (fs ? 0 : 48) : 14; + /* 栈页(从搜索/分类/我的进入的播放页、图文页)不显示底栏: + 底栏会盖住评论抽屉的输入框,且这些页面本身是沉浸的 */ + const stackInset = platform === "android" ? (fs ? 0 : 20) : 14; return (
@@ -115,11 +118,11 @@ function AppBody() { {stack.map((p, i) => (
- +
))} - {platform === "android" && !fs && } + {platform === "android" && !fs && stack.length === 0 && }
); diff --git a/src/components/Feed.tsx b/src/components/Feed.tsx index 0089a3a..3ead644 100644 --- a/src/components/Feed.tsx +++ b/src/components/Feed.tsx @@ -57,6 +57,23 @@ export default function Feed({ videoIds, startIndex = 0, title = "", mode, kind const setTheater = store.setTheater; const fs = store.fs; const setFs = store.setFs; + + /* 桌面:鼠标闲置 2.8s 自动隐藏播放器 UI(沉浸) */ + const [idle, setIdle] = useState(false); + const idleTimer = useRef(undefined); + const wake = useCallback(() => { + setIdle(false); + window.clearTimeout(idleTimer.current); + idleTimer.current = window.setTimeout(() => setIdle(true), 2800); + }, []); + useEffect(() => { + if (!isDesktop) return undefined; + wake(); + return () => window.clearTimeout(idleTimer.current); + }, [isDesktop, wake]); + useEffect(() => { + if (paused) { setIdle(false); window.clearTimeout(idleTimer.current); } + }, [paused]); const [fullscreen, setFullscreen] = useState(false); const [heartBurst, setHeartBurst] = useState(0); /* —— 移动端手势 —— */ @@ -442,7 +459,9 @@ export default function Feed({ videoIds, startIndex = 0, title = "", mode, kind } return ( -
+
{ if (isDesktop) wake(); }}> {/* 氛围背景 */}
{posterUrl && } @@ -459,7 +478,8 @@ export default function Feed({ videoIds, startIndex = 0, title = "", mode, kind
0 && vsize.w > vsize.h) ? "contain" : "cover"} onClick={() => { if (isDesktop) videoRef.current?.toggle(); }} onTime={setTime} onDuration={setDuration} @@ -644,7 +664,7 @@ export default function Feed({ videoIds, startIndex = 0, title = "", mode, kind e.ep_num === curEp + 1) && index >= videoIds.length - 1} nextTitle={episodes.some((e) => e.ep_num === curEp + 1) ? "下一集 E" : "下一部 ↓"} onToggle={() => videoRef.current?.toggle()} diff --git a/src/components/VideoSurface.tsx b/src/components/VideoSurface.tsx index 5226a6d..cbb756b 100644 --- a/src/components/VideoSurface.tsx +++ b/src/components/VideoSurface.tsx @@ -20,6 +20,9 @@ type Props = { muted?: boolean; loop?: boolean; fit?: "contain" | "cover"; + /** 换源后重新套用,避免切集时音量/倍速被浏览器重置 */ + volume?: number; + rate?: number; onTime?: (t: number) => void; onDuration?: (d: number) => void; onSize?: (w: number, h: number) => void; @@ -34,7 +37,7 @@ type Props = { /** 只负责「播」:hls.js + video 元素,控制条由外层渲染。 */ const VideoSurface = forwardRef(function VideoSurface( - { src, poster, autoPlay = true, muted = false, loop = false, fit = "contain", + { src, poster, autoPlay = true, muted = false, loop = false, fit = "contain", volume = 1, rate = 1, onTime, onDuration, onSize, onPlaying, onPause, onWaiting, onEnded, onError, onClick, className = "" }, ref, ) { @@ -67,6 +70,16 @@ const VideoSurface = forwardRef(function VideoSurface( const url = proxied ? src : playlist(src); const useHls = !url.includes("/seg?u="); + /* 换源时先把音量/倍速套回去:hls 重新 attach 后浏览器会把它们重置成默认值 */ + const applySettings = () => { + const v = videoRef.current; + if (!v) return; + v.volume = volume; + v.muted = muted; + v.playbackRate = rate; + }; + applySettings(); + if (useHls && Hls.isSupported()) { const hls = new Hls({ enableWorker: true, @@ -101,6 +114,14 @@ const VideoSurface = forwardRef(function VideoSurface( }, [src]); useEffect(() => { if (videoRef.current) videoRef.current.muted = muted; }, [muted]); + useEffect(() => { if (videoRef.current) videoRef.current.volume = volume; }, [volume]); + useEffect(() => { if (videoRef.current) videoRef.current.playbackRate = rate; }, [rate]); + + const reapply = (v: HTMLVideoElement) => { + v.volume = volume; + v.muted = muted; + v.playbackRate = rate; + }; return (