Remove video ads functionality and improve video data fetching
Remove VideoAds component from VideoPage and update BunnyService to fetch and include video descriptions from Bunny.net API. Replit-Commit-Author: Agent Replit-Commit-Session-Id: d7424866-83d1-4486-a212-ac12b4c7becf Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/d7424866-83d1-4486-a212-ac12b4c7becf/QHtchYG
This commit is contained in:
parent
4e4fe369c1
commit
6799bf0bbe
BIN
attached_assets/image_1756399694408.png
Normal file
BIN
attached_assets/image_1756399694408.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@ -2,7 +2,7 @@ import { useState, useEffect } from "react";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useRoute } from "wouter";
|
||||
import { type Video } from "@shared/schema";
|
||||
import VideoAds from "@/components/video-ads";
|
||||
|
||||
import go4LogoPath from "@assets/go4_1756394900352.png";
|
||||
// Helper functions
|
||||
const formatViews = (views: number): string => {
|
||||
@ -320,11 +320,6 @@ export default function VideoPage() {
|
||||
<p className="text-sm leading-relaxed">{currentVideo.description}</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Video ads metadata section */}
|
||||
<div className="mt-6 pt-4 border-t border-gray-600">
|
||||
<VideoAds videoId={currentVideo.id} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -70,7 +70,7 @@ export class BunnyService {
|
||||
return response.json();
|
||||
}
|
||||
|
||||
private bunnyVideoToVideo(bunnyVideo: BunnyVideo): Video {
|
||||
private bunnyVideoToVideo(bunnyVideo: BunnyVideo | BunnyVideoDetails): Video {
|
||||
// Generate optimized thumbnail URL from Bunny CDN with WebP format for better performance
|
||||
const thumbnailUrl = bunnyVideo.thumbnailFileName
|
||||
? `https://${this.hostname}/${bunnyVideo.guid}/${bunnyVideo.thumbnailFileName}?width=400&height=225&format=webp`
|
||||
@ -80,10 +80,13 @@ export class BunnyService {
|
||||
const hlsUrl = this.generateSignedUrl(bunnyVideo.guid);
|
||||
const iframeUrl = `https://iframe.mediadelivery.net/embed/${this.libraryId}/${bunnyVideo.guid}?preroll=false&postroll=false&ads=false`;
|
||||
|
||||
// Extract description from BunnyVideoDetails if available
|
||||
const description = 'description' in bunnyVideo ? bunnyVideo.description || "" : "";
|
||||
|
||||
return {
|
||||
id: bunnyVideo.guid,
|
||||
title: bunnyVideo.title || 'Untitled Video',
|
||||
description: "", // Bunny API doesn't return description in list view
|
||||
description: description,
|
||||
thumbnailUrl,
|
||||
customThumbnailUrl: null,
|
||||
videoUrl: hlsUrl, // Signed HLS URL
|
||||
@ -133,7 +136,9 @@ export class BunnyService {
|
||||
|
||||
async getVideo(guid: string): Promise<Video | null> {
|
||||
try {
|
||||
const bunnyVideo: BunnyVideo = await this.makeRequest(`videos/${guid}`);
|
||||
console.log(`Fetching video with description from Bunny: ${guid}`);
|
||||
const bunnyVideo: BunnyVideoDetails = await this.makeRequest(`videos/${guid}`);
|
||||
console.log(`Video description length: ${bunnyVideo.description?.length || 0} characters`);
|
||||
return this.bunnyVideoToVideo(bunnyVideo);
|
||||
} catch (error) {
|
||||
console.error(`Error fetching video ${guid} from Bunny:`, error);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user