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:
Yusuf İpek
2026-02-14 17:10:59 +03:00
parent d302875e25
commit e4b29f5829
6 changed files with 74 additions and 24 deletions
+1 -5
View File
@@ -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');
+1 -5
View File
@@ -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');