ShowerLoop-cc/docker/showerloop/public/js/video-init-fixed.js

68 lines
1.6 KiB
JavaScript

// Initialize videos when the DOM is fully loaded
document.addEventListener('DOMContentLoaded', function() {
console.log('[VIDEOJS] Initialization starting...');
if (typeof videojs === 'undefined') {
console.error('[VIDEOJS ERROR] VideoJS is not loaded!');
return;
}
// Hero video
try {
var heroVideo = videojs('video-hero-1741299175', {
html5: {
vhs: {
overrideNative: true
}
}
});
heroVideo.on('error', function() {
console.error('[VIDEOJS ERROR] Hero video error:', heroVideo.error());
});
console.log('[VIDEOJS] Hero video initialized');
} catch (e) {
console.error('[VIDEOJS ERROR] Failed to initialize hero video:', e);
}
// Video 2
try {
var video2 = videojs('video2', {
html5: {
vhs: {
overrideNative: true
}
}
});
video2.on('error', function() {
console.error('[VIDEOJS ERROR] Video2 error:', video2.error());
});
console.log('[VIDEOJS] Video2 initialized');
} catch (e) {
console.error('[VIDEOJS ERROR] Failed to initialize video2:', e);
}
// Video 3
try {
var video3 = videojs('video3', {
html5: {
vhs: {
overrideNative: true
}
}
});
video3.on('error', function() {
console.error('[VIDEOJS ERROR] Video3 error:', video3.error());
});
console.log('[VIDEOJS] Video3 initialized');
} catch (e) {
console.error('[VIDEOJS ERROR] Failed to initialize video3:', e);
}
console.log('[VIDEOJS] Initialization completed');
});