Files
KVideo/components/player/VideoPlayerError.tsx
T
kuekhaoyang 0e87c94a64 feat: 修复超长 URL (414) 问题,添加分辨率检测,修复高级模式 bug,提升兼容性
- 将 groupedSources 存储在 sessionStorage 中而非 URL 参数里,以防止因 URL 过长导致的 CDN 414 错误 (#112)
- 自动将旧版 groupedSources URL 迁移至短 gs 键
- 从视频元素中检测并显示实际视频分辨率(例如 1920x1080),不再依赖来源提供的标签
- 修复 PlayerNavbar 设置链接在高级模式下总是跳转到 /settings 而非 /premium/settings 的问题 (#106)
- 修复 WatchHistorySidebar 未向 HistoryList 传递 isPremium,导致历史记录项 URL 丢失 premium=1 参数的问题 (#106)
- 为 HLS 播放添加多级浏览器回退机制 (HLS.js → 原生 → 代理 → 错误并提供浏览器建议) (#104)
- 在 IPTV 播放器中添加 HEVC/H.265 级别过滤,防止 CCTV 等频道出现仅有音频播放的问题 (#81)
- 更新依赖并升级版本至 4.5.0
2026-03-12 22:58:30 +08:00

73 lines
2.5 KiB
TypeScript

'use client';
import { Button } from '@/components/ui/Button';
import { Icons } from '@/components/ui/Icon';
interface VideoPlayerErrorProps {
error: string;
onBack: () => void;
onRetry: () => void;
retryCount: number;
maxRetries: number;
}
export function VideoPlayerError({
error,
onBack,
onRetry,
retryCount,
maxRetries,
}: VideoPlayerErrorProps) {
return (
<div className="aspect-video bg-black rounded-[var(--radius-2xl)] flex items-center justify-center">
{/* Glass Card Container */}
<div
className="player-error-glass animate-in fade-in zoom-in-95 duration-300"
role="alert"
aria-live="assertive"
aria-atomic="true"
>
{/* Glowing Error Icon */}
<div className="relative">
<Icons.AlertTriangle
size={56}
className="error-icon mx-auto mb-4"
/>
{/* Glow effect */}
<div className="absolute inset-0 blur-xl bg-red-500/30 rounded-full -z-10" />
</div>
<h3>播放失败</h3>
<p>{error}</p>
{/* Browser compatibility hint */}
{(error.includes('不支持') || error.includes('格式') || error.includes('编码')) && (
<p className="text-xs text-white/50 mt-1">
建议使用 ChromeEdge Safari 浏览器以获得最佳兼容性
</p>
)}
{/* Action Buttons */}
<div className="flex gap-3 justify-center flex-wrap">
<button
onClick={onBack}
className="btn-glass px-4 py-2 flex items-center gap-2"
>
<Icons.ChevronLeft size={18} />
<span>返回</span>
</button>
{retryCount < maxRetries && (
<button
onClick={onRetry}
className="btn-glass px-4 py-2 flex items-center gap-2 !bg-[var(--accent-color)]/80 hover:!bg-[var(--accent-color)]"
>
<Icons.RefreshCw size={18} />
<span>重试 ({retryCount}/{maxRetries})</span>
</button>
)}
</div>
</div>
</div>
);
}