feat: add full source resolution probing and display in player UI

This commit is contained in:
kuekhaoyang
2026-03-18 13:06:58 +08:00
parent 064a27c8b6
commit 5d8c3daba0
5 changed files with 40 additions and 27 deletions
+8
View File
@@ -10,6 +10,7 @@ import { PlayerError } from '@/components/player/PlayerError';
import { SourceInfo } from '@/components/player/EpisodeList';
import type { VideoSource } from '@/lib/types';
import type { VideoResolutionInfo } from '@/components/player/hooks/useVideoResolution';
import { useResolutionProbe } from '@/lib/hooks/useResolutionProbe';
import { useVideoPlayer } from '@/lib/hooks/useVideoPlayer';
import { useHistory } from '@/lib/store/history-store';
import { FavoritesSidebar } from '@/components/favorites/FavoritesSidebar';
@@ -269,6 +270,12 @@ function PlayerContent() {
// Track detected video resolution from the player
const [detectedResolution, setDetectedResolution] = useState<VideoResolutionInfo | null>(null);
// Probe resolution for all grouped sources (not just the playing one)
const probeList = useMemo(() => {
return groupedSources.map(s => ({ id: s.id, source: s.source }));
}, [groupedSources]);
const { resolutions: sourceResolutions } = useResolutionProbe(probeList);
// Add initial history entry when video data is loaded
useEffect(() => {
if (videoData && playUrl && videoId) {
@@ -431,6 +438,7 @@ function PlayerContent() {
sources={groupedSources.length > 0 ? groupedSources : undefined}
currentSource={currentSourceId || source || ''}
currentResolution={detectedResolution}
sourceResolutions={sourceResolutions}
onSourceChange={(newSource) => {
const params = new URLSearchParams();
params.set('id', String(newSource.id));