mirror of
https://github.com/yusufipk/OpenFrame.git
synced 2026-09-11 17:46:06 +00:00
perf: improve audio streaming, font loading, and video provider timeouts
- Fix audio route content-type handling by using HeadObject metadata first - Add JetBrains Mono font optimization with display:swap and preload - Add blur placeholder to video card thumbnails for improved loading - Fix YouTube API loading with proper state tracking to prevent race conditions - Simplify timeout handling in YouTube and Vimeo providers using AbortSignal.timeout
This commit is contained in:
@@ -65,14 +65,10 @@ export const vimeoProvider: VideoProvider = {
|
||||
const cached = getCachedMetadata(cacheKey);
|
||||
if (cached) return cached;
|
||||
try {
|
||||
const controller = new AbortController();
|
||||
const timeoutId = setTimeout(() => controller.abort(), 10000); // 10 second timeout
|
||||
|
||||
const response = await fetch(
|
||||
`https://vimeo.com/api/oembed.json?url=https://vimeo.com/${videoId}`,
|
||||
{ signal: controller.signal }
|
||||
{ signal: AbortSignal.timeout(5000) }
|
||||
);
|
||||
clearTimeout(timeoutId);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to fetch video metadata');
|
||||
|
||||
@@ -64,14 +64,10 @@ export const youtubeProvider: VideoProvider = {
|
||||
// Using oEmbed API - no API key required
|
||||
// For production, you might want to use YouTube Data API for more data
|
||||
try {
|
||||
const controller = new AbortController();
|
||||
const timeoutId = setTimeout(() => controller.abort(), 10000); // 10 second timeout
|
||||
|
||||
const response = await fetch(
|
||||
`https://www.youtube.com/oembed?url=https://www.youtube.com/watch?v=${videoId}&format=json`,
|
||||
{ signal: controller.signal }
|
||||
{ signal: AbortSignal.timeout(5000) }
|
||||
);
|
||||
clearTimeout(timeoutId);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to fetch video metadata');
|
||||
|
||||
Reference in New Issue
Block a user