Restored to 'e087324c769fdb5e778619a362ad06f5e61119bf'
Replit-Restored-To: e087324c76
This commit is contained in:
+4
-5
@@ -52,13 +52,12 @@ export class BunnyService {
|
||||
}
|
||||
|
||||
private bunnyVideoToVideo(bunnyVideo: BunnyVideo): Video {
|
||||
// For private videos, we'll generate a video poster frame from the iframe
|
||||
// This is the best approach for private Bunny.net videos
|
||||
const thumbnailUrl = `https://iframe.mediadelivery.net/embed/${this.libraryId}/${bunnyVideo.guid}?poster=true`;
|
||||
// For private videos, use iframe embed or proxy approach
|
||||
// Generate thumbnail URL from CDN (thumbnails are usually public)
|
||||
const thumbnailUrl = `https://${this.hostname}/${bunnyVideo.guid}/thumbnail.jpg`;
|
||||
|
||||
// For private videos, we'll use an iframe embed URL which handles authentication
|
||||
// Enable controls, allow fullscreen, and ensure player functionality
|
||||
const videoUrl = `https://iframe.mediadelivery.net/embed/${this.libraryId}/${bunnyVideo.guid}?controls=true&autoplay=false&preload=metadata`;
|
||||
const videoUrl = `https://iframe.mediadelivery.net/embed/${this.libraryId}/${bunnyVideo.guid}`;
|
||||
|
||||
return {
|
||||
id: bunnyVideo.guid,
|
||||
|
||||
@@ -60,63 +60,6 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
||||
}
|
||||
});
|
||||
|
||||
// Serve video page with meta tags for social sharing
|
||||
app.get("/video/:id", async (req, res) => {
|
||||
try {
|
||||
const video = await storage.getVideo(req.params.id);
|
||||
if (!video) {
|
||||
return res.redirect("/");
|
||||
}
|
||||
|
||||
const shareUrl = `${req.protocol}://${req.get('host')}/video/${video.id}`;
|
||||
const html = `
|
||||
<!DOCTYPE html>
|
||||
<html lang="sl">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1" />
|
||||
<title>${video.title} - VideoStream</title>
|
||||
<meta name="description" content="${video.description || 'Oglej si ta video na VideoStream'}" />
|
||||
|
||||
<!-- Open Graph Meta Tags for Facebook -->
|
||||
<meta property="og:title" content="${video.title}" />
|
||||
<meta property="og:description" content="${video.description || 'Oglej si ta video na VideoStream'}" />
|
||||
<meta property="og:type" content="video.other" />
|
||||
<meta property="og:url" content="${shareUrl}" />
|
||||
<meta property="og:image" content="${video.thumbnailUrl}" />
|
||||
<meta property="og:image:width" content="1200" />
|
||||
<meta property="og:image:height" content="630" />
|
||||
<meta property="og:image:type" content="image/jpeg" />
|
||||
<meta property="og:site_name" content="VideoStream" />
|
||||
|
||||
<!-- Twitter Card Meta Tags -->
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta name="twitter:title" content="${video.title}" />
|
||||
<meta name="twitter:description" content="${video.description || 'Oglej si ta video na VideoStream'}" />
|
||||
<meta name="twitter:image" content="${video.thumbnailUrl}" />
|
||||
|
||||
<script>
|
||||
// Redirect to client-side app
|
||||
window.location.href = '/';
|
||||
setTimeout(() => {
|
||||
window.location.href = '/video/${video.id}';
|
||||
}, 100);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
<script type="text/javascript" src="https://replit.com/public/js/replit-dev-banner.js"></script>
|
||||
</body>
|
||||
</html>`;
|
||||
|
||||
res.send(html);
|
||||
} catch (error) {
|
||||
console.error("Error serving video page:", error);
|
||||
res.redirect("/");
|
||||
}
|
||||
});
|
||||
|
||||
const httpServer = createServer(app);
|
||||
return httpServer;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user