perf: Reduce segment download concurrency, replace Next.js Image with native img for poster images, and clean episode URLs by removing redundant slashes.

This commit is contained in:
kuekhaoyang
2025-11-23 17:13:23 +08:00
parent e2b31aa37d
commit 6dc6757ad1
3 changed files with 7 additions and 7 deletions
+3 -5
View File
@@ -2,7 +2,7 @@
* PosterImage - Video poster with fallback handling
*/
import Image from 'next/image';
import { Icons } from '@/components/ui/Icon';
interface PosterImageProps {
@@ -15,12 +15,10 @@ export function PosterImage({ poster, title, progress }: PosterImageProps) {
return (
<div className="relative w-28 h-16 flex-shrink-0 bg-[var(--glass-bg)] rounded-[var(--radius-2xl)] overflow-hidden">
{poster ? (
<Image
<img
src={poster}
alt={title}
fill
className="object-cover"
sizes="112px"
className="w-full h-full object-cover"
onError={(e) => {
const target = e.currentTarget as HTMLImageElement;
target.style.display = 'none';
+3 -1
View File
@@ -16,9 +16,11 @@ export function parseEpisodes(playUrl: string): Episode[] {
return episodes.map((episode, index) => {
const [name, url] = episode.split('$');
// Clean up URL: remove double slashes but keep protocol (http:// or https://)
const cleanUrl = (url || '').replace(/([^:])\/\//g, '$1/');
return {
name: name || `Episode ${index + 1}`,
url: url || '',
url: cleanUrl,
index,
};
});
+1 -1
View File
@@ -14,7 +14,7 @@ interface DownloadQueueOptions {
videoUrl?: string; // The m3u8 URL for metadata tracking
}
const CONCURRENCY = 1000;
const CONCURRENCY = 5;
const TIMEOUT_MS = 15000;
const CACHE_NAME = 'video-cache-v1';