Improve video ad delivery and error handling for streaming
Update route definitions in server/routes.ts to include TypeScript types for request and response objects, adjust ad fetching logic to prevent compression of video files, and modify error logging to include the correct video ID. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 344ec1e0-1186-4058-bbff-2e9619a7b1e0 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/344ec1e0-1186-4058-bbff-2e9619a7b1e0/FgaI1Sc
This commit is contained in:
parent
b2a4cfd8d4
commit
4b478e6e40
BIN
attached_assets/image_1756594164880.png
Normal file
BIN
attached_assets/image_1756594164880.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 143 KiB |
@ -57,7 +57,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
||||
app.use(compression({
|
||||
level: 6,
|
||||
threshold: 1024, // Only compress responses larger than 1KB
|
||||
filter: (req, res) => {
|
||||
filter: (req: any, res: any) => {
|
||||
// Don't compress video files
|
||||
if (req.headers['accept']?.includes('video/')) {
|
||||
return false;
|
||||
@ -368,7 +368,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
||||
}
|
||||
|
||||
// Get ads from Bunny.net API
|
||||
let ads = [];
|
||||
let ads: any[] = [];
|
||||
try {
|
||||
const { BunnyService } = await import("./bunny");
|
||||
const bunnyService = new BunnyService();
|
||||
@ -386,7 +386,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
||||
totalAds: ads.length
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(`Error fetching ads for video ${id}:`, error);
|
||||
console.error(`Error fetching ads for video ${req.params.id}:`, error);
|
||||
res.status(500).json({ message: "Failed to fetch video ads" });
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user