mirror of
https://github.com/KuekHaoYang/KVideo.git
synced 2026-08-16 17:23:43 +08:00
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:
@@ -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
@@ -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,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user