Enable video ads to generate revenue from premium video content
Integrates Google IMA SDK with videojs-contrib-ads to support VAST advertisements, enhances debugging, and adds event listeners. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 11420304-80a9-4ef2-adff-cbdaa418ffa8 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/11420304-80a9-4ef2-adff-cbdaa418ffa8/nFqFD52
This commit is contained in:
parent
b6654c0ff9
commit
bc727b1d36
@ -123,14 +123,33 @@ export default function VideoModal({ video, isOpen, onClose }: VideoModalProps)
|
||||
player.ready(() => {
|
||||
console.log('Video.js player ready');
|
||||
|
||||
// Only initialize ads if plugins are properly loaded
|
||||
// Initialize ads plugin first
|
||||
if (typeof (player as any).ads === 'function') {
|
||||
try {
|
||||
(player as any).ads({
|
||||
debug: false,
|
||||
prerollTimeout: 1000
|
||||
debug: true,
|
||||
prerollTimeout: 3000,
|
||||
postrollTimeout: 3000,
|
||||
timeout: 5000
|
||||
});
|
||||
console.log('Ads plugin initialized');
|
||||
|
||||
// Then initialize IMA plugin for VAST ads
|
||||
if (typeof (player as any).ima === 'function') {
|
||||
(player as any).ima({
|
||||
id: video.id,
|
||||
adTagUrl: 'https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dlinear&correlator=' + Math.round(Math.random() * 100000000),
|
||||
debug: true,
|
||||
timeout: 5000,
|
||||
maxRedirects: 4,
|
||||
vpaidMode: 'ENABLED',
|
||||
vpaidAllowed: true,
|
||||
autoPlayAdBreaks: true,
|
||||
adLabel: 'Advertisement',
|
||||
showControlsForJSAds: true
|
||||
});
|
||||
console.log('IMA plugin initialized with VAST ads');
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('Ads plugin initialization failed:', error);
|
||||
}
|
||||
@ -145,6 +164,27 @@ export default function VideoModal({ video, isOpen, onClose }: VideoModalProps)
|
||||
handleVideoPlay();
|
||||
});
|
||||
|
||||
// Ads event listeners
|
||||
player.on('ads-request', () => {
|
||||
console.log('Ad request initiated');
|
||||
});
|
||||
|
||||
player.on('ads-load', () => {
|
||||
console.log('Ad loaded successfully');
|
||||
});
|
||||
|
||||
player.on('ads-start', () => {
|
||||
console.log('Ad playback started');
|
||||
});
|
||||
|
||||
player.on('ads-end', () => {
|
||||
console.log('Ad playback ended');
|
||||
});
|
||||
|
||||
player.on('ads-error', (error: any) => {
|
||||
console.log('Ad error:', error);
|
||||
});
|
||||
|
||||
playerRef.current = player;
|
||||
} catch (error) {
|
||||
console.error('Failed to initialize Video.js player:', error);
|
||||
|
||||
@ -8,7 +8,7 @@ VideoStream is a fully functional video streaming platform that integrates direc
|
||||
|
||||
- ✅ **Video.js + VAST Plugin Architecture**: Migrated from HLS.js to Video.js with IMA SDK for professional video streaming and advertising
|
||||
- ✅ **Advanced Video Controls**: Professional video player with fluid responsive design and adaptive streaming
|
||||
- ✅ **VAST Advertising Support**: Integrated videojs-contrib-ads and videojs-ima for pre-roll, mid-roll, and post-roll video advertisements
|
||||
- ✅ **VAST Advertising Support**: Integrated videojs-contrib-ads and videojs-ima for pre-roll, mid-roll, and post-roll video advertisements with Google DoubleClick integration
|
||||
- ✅ **Search Functionality**: Client-side search working with proper text visibility (white background, black text)
|
||||
- ✅ **Bunny.net Integration**: Complete integration with private video library using signed URLs for secure access
|
||||
- ✅ **Error Handling**: Robust error handling with Video.js fallback mechanisms
|
||||
|
||||
Loading…
Reference in New Issue
Block a user