diff --git a/components/player/hooks/useHlsPlayer.ts b/components/player/hooks/useHlsPlayer.ts index 4b4ec8c..8d186af 100644 --- a/components/player/hooks/useHlsPlayer.ts +++ b/components/player/hooks/useHlsPlayer.ts @@ -135,17 +135,30 @@ export function useHlsPlayer({ // Manifest Parsed Handler hls.on(Hls.Events.MANIFEST_PARSED, () => { - // Check for HEVC + // Filter HEVC levels: prefer H.264 for compatibility if (hls) { const levels = hls.levels; if (levels && levels.length > 0) { - const hasHEVC = levels.some(level => - level.videoCodec?.toLowerCase().includes('hev') || - level.videoCodec?.toLowerCase().includes('h265') - ); + const h264Indices: number[] = []; + let hasHEVC = false; + levels.forEach((level, index) => { + const codec = level.videoCodec?.toLowerCase() || ''; + if (codec.includes('hev') || codec.includes('h265') || codec.includes('hvc')) { + hasHEVC = true; + } else { + h264Indices.push(index); + } + }); if (hasHEVC) { - console.warn('[HLS] ⚠️ HEVC detected'); - onError?.('检测到 HEVC/H.265 编码,当前浏览器可能不支持'); + if (h264Indices.length > 0) { + // H.264 alternatives exist — lock to first H.264 level + console.info('[HLS] HEVC detected, using H.264 level for compatibility'); + hls.currentLevel = h264Indices[0]; + } else { + // All levels are HEVC — warn user + console.warn('[HLS] ⚠️ All levels are HEVC, browser may not support'); + onError?.('检测到 HEVC/H.265 编码,当前浏览器可能不支持'); + } } } } diff --git a/components/search/VideoGroupCard.tsx b/components/search/VideoGroupCard.tsx index 69a3c31..ce83b45 100644 --- a/components/search/VideoGroupCard.tsx +++ b/components/search/VideoGroupCard.tsx @@ -76,8 +76,12 @@ export const VideoGroupCard = memo(({ } } + if (isPremium) { + params.set('premium', '1'); + } + return `/player?${params.toString()}`; - }, [representative, videos]); + }, [representative, videos, isPremium]); return (