feat: add playback control lock and release v1.2.0
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "huangguo-client",
|
||||
"private": true,
|
||||
"version": "1.1.0",
|
||||
"version": "1.2.0",
|
||||
"license": "PolyForm-Noncommercial-1.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
Generated
+1
-1
@@ -1605,7 +1605,7 @@ checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
|
||||
|
||||
[[package]]
|
||||
name = "huangguo-client"
|
||||
version = "1.1.0"
|
||||
version = "1.2.0"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"base64 0.22.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "huangguo-client"
|
||||
version = "1.1.0"
|
||||
version = "1.2.0"
|
||||
description = "HGhub · 黄果短剧客户端"
|
||||
authors = ["HGhub"]
|
||||
license = "PolyForm-Noncommercial-1.0.0"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "HGhub",
|
||||
"version": "1.1.0",
|
||||
"version": "1.2.0",
|
||||
"identifier": "com.hghub.huangguo",
|
||||
"build": {
|
||||
"beforeDevCommand": "pnpm dev",
|
||||
|
||||
+48
-18
@@ -5,11 +5,12 @@ import { useStore } from "../store";
|
||||
import { Avatar, Img, Sheet } from "./ui";
|
||||
import VideoSurface, { type VideoHandle } from "./VideoSurface";
|
||||
import PlayerControls from "./PlayerControls";
|
||||
import PlaybackLock from "./PlaybackLock";
|
||||
import { ArticlePanel, CommentsPanel, EpisodesPanel } from "./Panels";
|
||||
import { setBackHandler } from "../back";
|
||||
import {
|
||||
IBack, IBoltF, IChevR, IChevronDown, IChevronUp, IClose, ICommentF, ICompress, IExpand, IFileText, IHeart, IHeartF,
|
||||
ILink, IList, ILockF, IPauseF, IPlayF, IStar, IStarF, IVol, IVolMute,
|
||||
ILink, IList, ILockF, IPauseF, IPlayF, ISearch, IStar, IStarF, IVol, IVolMute,
|
||||
} from "../icons";
|
||||
|
||||
type Props = {
|
||||
@@ -50,6 +51,7 @@ export default function Feed({ videoIds, startIndex = 0, title = "", mode, kind
|
||||
const [vsize, setVsize] = useState({ w: 0, h: 0 });
|
||||
const [buffered, setBuffered] = useState(0);
|
||||
const [paused, setPaused] = useState(false);
|
||||
const [controlsLocked, setControlsLocked] = useState(false);
|
||||
const [rate, setRate] = useState(1);
|
||||
const [waiting, setWaiting] = useState(false);
|
||||
const [err, setErr] = useState("");
|
||||
@@ -99,7 +101,7 @@ export default function Feed({ videoIds, startIndex = 0, title = "", mode, kind
|
||||
const [barPct, setBarPct] = useState<number | null>(null);
|
||||
const gesture = useRef<{
|
||||
x: number; y: number; startY: number; t: number; timer: number | null;
|
||||
mode: "idle" | "hold" | "scrub"; base: number; width: number;
|
||||
mode: "idle" | "hold" | "scrub" | "pan"; base: number; width: number; playing: boolean;
|
||||
} | null>(null);
|
||||
|
||||
const curId = videoIds[index];
|
||||
@@ -270,7 +272,7 @@ export default function Feed({ videoIds, startIndex = 0, title = "", mode, kind
|
||||
|
||||
/* 键盘 */
|
||||
useEffect(() => {
|
||||
if (!active) return;
|
||||
if (!active || controlsLocked) return;
|
||||
const fn = (e: KeyboardEvent) => {
|
||||
const t = e.target as HTMLElement;
|
||||
if (t && (t.tagName === "INPUT" || t.tagName === "TEXTAREA")) return;
|
||||
@@ -294,7 +296,7 @@ export default function Feed({ videoIds, startIndex = 0, title = "", mode, kind
|
||||
window.addEventListener("keydown", fn);
|
||||
return () => window.removeEventListener("keydown", fn);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [active, panel, time, index]);
|
||||
}, [active, controlsLocked, panel, time, index]);
|
||||
|
||||
/* 安卓返回键:面板打开时先关面板 */
|
||||
useEffect(() => {
|
||||
@@ -318,13 +320,14 @@ export default function Feed({ videoIds, startIndex = 0, title = "", mode, kind
|
||||
|
||||
/* —— 长按 2x(上滑锁定) / 横拖定位 / 单击暂停 —— */
|
||||
const onDown = (e: React.PointerEvent<HTMLDivElement>) => {
|
||||
if (isDesktop) return;
|
||||
if (isDesktop || controlsLocked || !active || gesture.current || e.button !== 0) return;
|
||||
const el = e.currentTarget;
|
||||
const width = el.clientWidth || 1;
|
||||
try { el.setPointerCapture(e.pointerId); } catch { /* ignore */ }
|
||||
const g = {
|
||||
x: e.clientX, y: e.clientY, startY: e.clientY, t: Date.now(), base: time, width,
|
||||
mode: "idle" as "idle" | "hold" | "scrub",
|
||||
mode: "idle" as "idle" | "hold" | "scrub" | "pan",
|
||||
playing: videoRef.current?.el()?.paused === false,
|
||||
timer: window.setTimeout(() => {
|
||||
const cur = gesture.current;
|
||||
if (!cur || cur.mode !== "idle") return;
|
||||
@@ -362,6 +365,7 @@ export default function Feed({ videoIds, startIndex = 0, title = "", mode, kind
|
||||
videoRef.current?.pause();
|
||||
} else if (Math.abs(dy) > 14) {
|
||||
if (g.timer) window.clearTimeout(g.timer);
|
||||
g.mode = "pan";
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -375,7 +379,7 @@ export default function Feed({ videoIds, startIndex = 0, title = "", mode, kind
|
||||
}
|
||||
};
|
||||
|
||||
const onUp = () => {
|
||||
const onUp = (cancelled = false) => {
|
||||
const g = gesture.current;
|
||||
gesture.current = null;
|
||||
if (!g) return;
|
||||
@@ -384,7 +388,7 @@ export default function Feed({ videoIds, startIndex = 0, title = "", mode, kind
|
||||
if (g.mode === "hold") {
|
||||
holdRef.current = false;
|
||||
setHoldSpeed(false);
|
||||
if (lockArmedRef.current) {
|
||||
if (!cancelled && lockArmedRef.current) {
|
||||
setSpeedLock(true);
|
||||
toast("已锁定 2.0x 倍速 · 点顶部标签解除", "info");
|
||||
}
|
||||
@@ -394,15 +398,28 @@ export default function Feed({ videoIds, startIndex = 0, title = "", mode, kind
|
||||
}
|
||||
if (g.mode === "scrub") {
|
||||
const target = scrubTarget.current;
|
||||
if (target != null) videoRef.current?.seek(target, "mobile_gesture");
|
||||
if (!cancelled && target != null) videoRef.current?.seek(target, "mobile_gesture");
|
||||
setScrub(null);
|
||||
scrubTarget.current = null;
|
||||
if (!paused) videoRef.current?.play();
|
||||
if (g.playing && active) videoRef.current?.play();
|
||||
return;
|
||||
}
|
||||
if (Date.now() - g.t < 260) videoRef.current?.toggle();
|
||||
if (!cancelled && g.mode === "idle" && Date.now() - g.t < 260) videoRef.current?.toggle();
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (!active || controlsLocked) onUp(true);
|
||||
// Cancel pending gestures when the page is hidden or controls are locked.
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [active, controlsLocked]);
|
||||
|
||||
useEffect(() => () => {
|
||||
if (gesture.current?.timer) window.clearTimeout(gesture.current.timer);
|
||||
gesture.current = null;
|
||||
}, [playKey]);
|
||||
|
||||
const lockControls = () => { setPanel(null); setControlsLocked(true); };
|
||||
|
||||
/* 长按倍速期间禁止原生滚动,否则上滑会被列表吃掉、锁不住倍速 */
|
||||
useEffect(() => {
|
||||
if (isDesktop) return undefined;
|
||||
@@ -506,8 +523,9 @@ export default function Feed({ videoIds, startIndex = 0, title = "", mode, kind
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`hg-player-ui absolute inset-0 overflow-hidden bg-black player-root ${isDesktop ? "player-surface" : ""} ${theater ? "is-theater" : ""} ${rotated ? "fs-landscape" : ""} ${isDesktop && idle ? "is-idle" : ""}`}
|
||||
className={`hg-player-ui absolute inset-0 overflow-hidden bg-black player-root ${controlsLocked ? "is-locked" : ""} ${isDesktop ? "player-surface" : ""} ${theater ? "is-theater" : ""} ${rotated ? "fs-landscape" : ""} ${isDesktop && idle ? "is-idle" : ""}`}
|
||||
onPointerMove={() => { if (isDesktop) wake(); }}>
|
||||
<div className="absolute inset-0" inert={controlsLocked}>
|
||||
{/* 氛围背景 */}
|
||||
<div className="absolute inset-0 scale-110 blur-3xl opacity-25 pointer-events-none">
|
||||
{posterUrl && <img src={posterUrl} alt="" className="w-full h-full object-cover" />}
|
||||
@@ -522,7 +540,7 @@ export default function Feed({ videoIds, startIndex = 0, title = "", mode, kind
|
||||
<section key={vid} className="relative w-full h-full snap-start snap-always overflow-hidden">
|
||||
{isActive && playUrl ? (
|
||||
<div className="absolute inset-0" style={{ touchAction: "pan-y" }}
|
||||
onPointerDown={onDown} onPointerMove={onMove} onPointerUp={onUp} onPointerCancel={onUp}>
|
||||
onPointerDown={onDown} onPointerMove={onMove} onPointerUp={() => onUp()} onPointerCancel={() => onUp(true)} onLostPointerCapture={() => onUp(true)}>
|
||||
<VideoSurface ref={videoRef} src={playUrl} poster={posterUrl} autoPlay active={active} muted={muted}
|
||||
diagnosticContext={{ active, view: mode, kind, video_id: curId, episode: curEp }}
|
||||
volume={volume} rate={effRate}
|
||||
@@ -568,13 +586,10 @@ export default function Feed({ videoIds, startIndex = 0, title = "", mode, kind
|
||||
<small>{index + 1} / {videoIds.length}</small>
|
||||
</div>
|
||||
) : (
|
||||
<div className="absolute inset-x-0 z-20 flex items-center gap-2 px-2.5" style={{ top: "calc(var(--sat, 0px) + 8px)" }}>
|
||||
<div className="absolute inset-x-0 z-20 flex items-center gap-2 px-2.5" style={{ top: "calc(var(--sat, 0px) + 8px)", paddingRight: 148 }}>
|
||||
<button onClick={onBack} aria-label="返回" className="hg-chip w-9 h-9 rounded-full flex items-center justify-center pressable elev-1"><IBack size={20} /></button>
|
||||
<span className="text-[14.5px] font-semibold hg-ink hg-ov-shadow truncate">{title}</span>
|
||||
<span className="ml-auto px-2 py-0.5 rounded-full hg-chip text-[11px] font-semibold" style={{ color: "rgba(255,255,255,.9)" }}>{index + 1} / {videoIds.length}</span>
|
||||
<button onClick={() => setMuted((m) => !m)} aria-label={muted ? "取消静音" : "静音"} className="hg-chip w-9 h-9 rounded-full flex items-center justify-center pressable elev-1">
|
||||
{muted ? <IVolMute size={17} /> : <IVol size={17} />}
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
) : null}
|
||||
@@ -748,7 +763,7 @@ export default function Feed({ videoIds, startIndex = 0, title = "", mode, kind
|
||||
paused={paused} time={time} duration={duration} buffered={buffered} rate={rate}
|
||||
muted={muted} volume={volume} theater={theater} fullscreen={fullscreen}
|
||||
visible={active && !idle}
|
||||
seekEnabled={active}
|
||||
seekEnabled={active && !controlsLocked}
|
||||
seekKey={playKey}
|
||||
nextDisabled={!episodes.some((e) => e.ep_num === curEp + 1) && index >= videoIds.length - 1}
|
||||
nextTitle={episodes.some((e) => e.ep_num === curEp + 1) ? "下一集 E" : "下一部 ↓"}
|
||||
@@ -759,6 +774,7 @@ export default function Feed({ videoIds, startIndex = 0, title = "", mode, kind
|
||||
onMute={() => setMuted((m) => !m)}
|
||||
onVolume={(v) => setVolume(v)}
|
||||
onPip={togglePip}
|
||||
onLock={lockControls}
|
||||
onTheater={() => setTheater((v) => !v)}
|
||||
onFullscreen={toggleFull}
|
||||
onNext={() => {
|
||||
@@ -928,6 +944,20 @@ export default function Feed({ videoIds, startIndex = 0, title = "", mode, kind
|
||||
</Sheet>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
{!isDesktop && !controlsLocked && active && (
|
||||
<div className={`absolute z-40 flex items-center gap-2 ${fs ? "right-14" : "right-3"}`} style={{ top: "calc(var(--sat, 0px) + 6px)" }}>
|
||||
{!fs && <button onClick={() => setMuted(m => !m)} aria-label={muted ? "取消静音" : "静音"}
|
||||
className="hg-chip w-9 h-9 rounded-full flex items-center justify-center pressable elev-1">
|
||||
{muted ? <IVolMute size={17} /> : <IVol size={17} />}
|
||||
</button>}
|
||||
<button onClick={lockControls} aria-label="锁定播放控制" title="锁定播放控制" aria-pressed={false}
|
||||
className="hg-chip w-9 h-9 rounded-full flex items-center justify-center pressable elev-1"><ILockF size={17} /></button>
|
||||
{!fs && <button onClick={() => store.setTab("search")} aria-label="搜索"
|
||||
className="hg-chip w-9 h-9 rounded-full flex items-center justify-center pressable elev-1"><ISearch size={18} /></button>}
|
||||
</div>
|
||||
)}
|
||||
{controlsLocked && <PlaybackLock active={active} onUnlock={() => { setControlsLocked(false); wake(); }} />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import { useEffect } from "react";
|
||||
import { ILockF } from "../icons";
|
||||
|
||||
/** Shield pointer input and playback shortcuts without pausing the media. */
|
||||
export default function PlaybackLock({ active, onUnlock }: { active: boolean; onUnlock: () => void }) {
|
||||
useEffect(() => {
|
||||
if (!active) return;
|
||||
const block = (e: KeyboardEvent) => {
|
||||
const target = e.target as HTMLElement | null;
|
||||
if (target?.closest("input, textarea, [contenteditable='true'], [data-playback-unlock]")) return;
|
||||
const key = e.key.length === 1 ? e.key.toLowerCase() : e.key;
|
||||
if ([" ", "Enter", "ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Home", "End", "PageUp", "PageDown", "f", "t", "m", "l", "s", "c", "e"].includes(key)) {
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
};
|
||||
window.addEventListener("keydown", block, true);
|
||||
return () => window.removeEventListener("keydown", block, true);
|
||||
}, [active]);
|
||||
|
||||
return <div data-playback-lock-shield className="absolute inset-0 z-50" style={{ touchAction: "none" }}
|
||||
onPointerDown={e => e.stopPropagation()} onClick={e => e.stopPropagation()} onWheel={e => e.stopPropagation()}>
|
||||
<button type="button" data-playback-unlock aria-label="解锁播放控制" title="解锁播放控制" aria-pressed
|
||||
onClick={onUnlock} className="playback-unlock absolute right-3 top-1/2 -translate-y-1/2 w-11 h-11 rounded-full flex items-center justify-center">
|
||||
<ILockF size={19} />
|
||||
</button>
|
||||
</div>;
|
||||
}
|
||||
@@ -4,7 +4,8 @@ import { fmtTime, playlist } from "../api";
|
||||
import { mediaResource, observeHls, usePlayerDiagnostics } from "../playbackDiagnostics";
|
||||
import { usePlaybackActivity } from "../usePlaybackActivity";
|
||||
import { useSeekInput } from "../useSeekInput";
|
||||
import { ICompress, IExpand, IPauseF, IPlayF, IVol, IVolMute } from "../icons";
|
||||
import PlaybackLock from "./PlaybackLock";
|
||||
import { ICompress, IExpand, ILockF, IPauseF, IPlayF, IVol, IVolMute } from "../icons";
|
||||
|
||||
type Props = {
|
||||
src: string; // 原始 m3u8 地址
|
||||
@@ -38,7 +39,8 @@ export default function Player({
|
||||
const [full, setFull] = useState(false);
|
||||
const [rate, setRate] = useState(1);
|
||||
const [errMsg, setErrMsg] = useState<string>("");
|
||||
const seek = useSeekInput({ time, duration, enabled: active, resetKey: src,
|
||||
const [controlsLocked, setControlsLocked] = useState(false);
|
||||
const seek = useSeekInput({ time, duration, enabled: active && !controlsLocked, resetKey: src,
|
||||
onInteraction: (phase, input, target, pointerTarget) => trace(`seek.input.${phase}`, { input, target, pointer_target: pointerTarget }),
|
||||
onSeek: (target, input) => {
|
||||
const video = videoRef.current;
|
||||
@@ -144,6 +146,7 @@ export default function Player({
|
||||
|
||||
return (
|
||||
<div ref={wrapRef} className={`relative bg-black overflow-hidden group ${className}`}>
|
||||
<div className="absolute inset-0" inert={controlsLocked}>
|
||||
<video
|
||||
ref={videoRef}
|
||||
poster={poster}
|
||||
@@ -195,6 +198,9 @@ export default function Player({
|
||||
</button>
|
||||
<span className="text-[11px] tabular-nums text-white/85">{fmtTime(seek.time)} / {fmtTime(duration)}</span>
|
||||
<div className="flex-1" />
|
||||
<button onClick={() => setControlsLocked(true)} aria-label="锁定播放控制" title="锁定播放控制" aria-pressed={false} className="pressable">
|
||||
<ILockF size={16} />
|
||||
</button>
|
||||
<button onClick={cycleRate} className="text-[11px] font-bold text-white/85 pressable tabular-nums">{rate}x</button>
|
||||
<button onClick={toggleFull} aria-label="全屏" className="pressable">
|
||||
{full ? <ICompress size={16} /> : <IExpand size={16} />}
|
||||
@@ -202,6 +208,8 @@ export default function Player({
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{controlsLocked && <PlaybackLock active={active} onUnlock={() => setControlsLocked(false)} />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { fmtTime } from "../api";
|
||||
import { useSeekInput } from "../useSeekInput";
|
||||
import { ICheck, ICompress, IExpand, INext, IPauseF, IPip, IPlayF, ITheater, IVol, IVolMute } from "../icons";
|
||||
import { ICheck, ICompress, IExpand, ILockF, INext, IPauseF, IPip, IPlayF, ITheater, IVol, IVolMute } from "../icons";
|
||||
|
||||
type Props = {
|
||||
paused: boolean;
|
||||
@@ -25,6 +25,7 @@ type Props = {
|
||||
onMute: () => void;
|
||||
onVolume: (v: number) => void;
|
||||
onPip: () => void;
|
||||
onLock: () => void;
|
||||
onTheater?: () => void;
|
||||
onFullscreen: () => void;
|
||||
onNext?: () => void;
|
||||
@@ -34,7 +35,7 @@ const clock = (s: number) => fmtTime(Math.max(0, s || 0)).padStart(5, "0");
|
||||
|
||||
export default function PlayerControls({
|
||||
paused, time, duration, buffered = 0, rate, muted, volume, theater = false, fullscreen = false,
|
||||
visible = true, seekEnabled = true, seekKey, nextDisabled = false, nextTitle = "下一个", onToggle, onSeek, onSeekInteraction, onRate, onMute, onVolume, onPip, onTheater, onFullscreen, onNext,
|
||||
visible = true, seekEnabled = true, seekKey, nextDisabled = false, nextTitle = "下一个", onToggle, onSeek, onSeekInteraction, onRate, onMute, onVolume, onPip, onLock, onTheater, onFullscreen, onNext,
|
||||
}: Props) {
|
||||
const [speedOpen, setSpeedOpen] = useState(false);
|
||||
const boxRef = useRef<HTMLDivElement>(null);
|
||||
@@ -98,6 +99,7 @@ export default function PlayerControls({
|
||||
</div>
|
||||
</div>
|
||||
<button className="player-control" aria-label="画中画" data-tooltip="画中画" onClick={onPip}><IPip size={20} strokeWidth={1.6} /></button>
|
||||
<button className="player-control" aria-label="锁定播放控制" aria-pressed={false} data-tooltip="锁定播放控制" onClick={onLock}><ILockF size={18} /></button>
|
||||
{!fullscreen && onTheater && (
|
||||
<button className={`player-control ${theater ? "is-on" : ""}`} aria-label="影院模式" aria-pressed={theater}
|
||||
data-tooltip="影院模式 T" onClick={onTheater}><ITheater size={20} strokeWidth={1.6} /></button>
|
||||
|
||||
@@ -352,6 +352,12 @@ input[type="range"].hg-range::-webkit-slider-thumb { -webkit-appearance: none; w
|
||||
transition: opacity .25s;
|
||||
}
|
||||
.desktop-controls.is-hidden { opacity: 0; pointer-events: none; }
|
||||
.playback-unlock { color: rgba(255,255,255,.38); background: rgba(0,0,0,.12); transition: color .2s, background .2s; }
|
||||
.playback-unlock:hover, .playback-unlock:focus-visible { color: rgba(255,255,255,.9); background: rgba(0,0,0,.4); }
|
||||
.player-root.is-locked [inert] button,
|
||||
.player-root.is-locked .desktop-controls,
|
||||
.player-root.is-locked .desktop-video-meta,
|
||||
.player-root.is-locked .desktop-social { visibility: hidden; }
|
||||
.desktop-control-row { display: flex; align-items: center; gap: 5px; height: 38px; }
|
||||
.player-control {
|
||||
height: 32px; min-width: 32px; padding: 0 8px; border-radius: 7px;
|
||||
|
||||
+3
-19
@@ -1,13 +1,13 @@
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import Feed from "../components/Feed";
|
||||
import { api, isMobile } from "../api";
|
||||
import { api } from "../api";
|
||||
import type { VideoCard } from "../types";
|
||||
import { useStore } from "../store";
|
||||
import { ISearch, IVol, IVolMute } from "../icons";
|
||||
import { ISearch } from "../icons";
|
||||
import { Empty } from "../components/ui";
|
||||
|
||||
export default function Home({ active, bottomInset }: { active: boolean; bottomInset: number }) {
|
||||
const { muted, setMuted, setTab, toast, fs } = useStore();
|
||||
const { toast } = useStore();
|
||||
const [items, setItems] = useState<VideoCard[]>([]);
|
||||
const [page, setPage] = useState(1);
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -57,22 +57,6 @@ export default function Home({ active, bottomInset }: { active: boolean; bottomI
|
||||
) : (
|
||||
<div className="absolute inset-0 flex items-center justify-center"><div className="w-9 h-9 spinner" /></div>
|
||||
)}
|
||||
|
||||
{/* 移动端:静音 + 搜索(压在视频上,固定白字 + 半透明黑底) */}
|
||||
{isMobile && !fs && (
|
||||
<div className="absolute inset-x-0 z-20 flex items-center px-3 pointer-events-none hg-player-ui" style={{ top: "calc(var(--sat, 0px) + 6px)" }}>
|
||||
<div className="ml-auto flex items-center gap-2">
|
||||
<button onClick={() => setMuted((m) => !m)} aria-label={muted ? "取消静音" : "静音"}
|
||||
className="hg-chip pointer-events-auto w-9 h-9 rounded-full flex items-center justify-center pressable elev-1">
|
||||
{muted ? <IVolMute size={17} /> : <IVol size={17} />}
|
||||
</button>
|
||||
<button onClick={() => setTab("search")} aria-label="搜索"
|
||||
className="hg-chip pointer-events-auto w-9 h-9 rounded-full flex items-center justify-center pressable elev-1">
|
||||
<ISearch size={18} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user