mirror of
https://github.com/zimplexing/OrionTV.git
synced 2026-05-21 09:17:30 +08:00
Refactor & Fix issue
This commit is contained in:
@@ -7,7 +7,8 @@ const resolutionCache: { [url: string]: CacheEntry } = {};
|
||||
const CACHE_DURATION = 5 * 60 * 1000; // 5 minutes
|
||||
|
||||
export const getResolutionFromM3U8 = async (
|
||||
url: string
|
||||
url: string,
|
||||
signal?: AbortSignal
|
||||
): Promise<string | null> => {
|
||||
// 1. Check cache first
|
||||
const cachedEntry = resolutionCache[url];
|
||||
@@ -20,7 +21,7 @@ export const getResolutionFromM3U8 = async (
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch(url);
|
||||
const response = await fetch(url, { signal });
|
||||
if (!response.ok) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user