FIX: FocusVideoPlayer video library access

Video Library Integration:
- Fixed video library access to use videoManager.videoLibrary structure
- Added support for all categories: task, background, reward, punishment
- Enhanced logging to show videos found per category
- Added fallback for different video manager implementations

 Compatibility:
- Works with actual VideoPlayerManager structure
- Better error handling and debugging information
- Should now find videos if they exist in the library
This commit is contained in:
dilgenfritz 2025-10-31 07:46:47 -05:00
parent e63478013a
commit 7f553fe604
1 changed files with 19 additions and 5 deletions

View File

@ -66,11 +66,25 @@ class FocusVideoPlayer extends BaseVideoPlayer {
}
this.videoLibrary = [];
const categories = ['task', 'background', 'reward'];
for (const category of categories) {
const videos = videoManager.getVideosByCategory?.(category) || [];
this.videoLibrary.push(...videos);
// Check if videoManager has videoLibrary structure
if (videoManager.videoLibrary) {
const categories = ['task', 'background', 'reward', 'punishment'];
for (const category of categories) {
const videos = videoManager.videoLibrary[category] || [];
this.videoLibrary.push(...videos);
console.log(`🧘 📹 Found ${videos.length} videos in ${category} category`);
}
} else if (videoManager.getVideosByCategory) {
// Fallback for different video manager implementations
const categories = ['task', 'background', 'reward'];
for (const category of categories) {
const videos = videoManager.getVideosByCategory(category) || [];
this.videoLibrary.push(...videos);
}
} else {
console.warn('🧘 ⚠️ Video manager structure not recognized');
}
console.log(`🧘 🎬 Initialized focus video library with ${this.videoLibrary.length} videos`);