# 🎬 Video Streaming Integration Guide This guide shows how to integrate the modular video streaming feature into your existing dashboard. ## 🚀 Quick Start ### 1. Add to Dashboard Navigation Update your sidebar or navigation to include the video streaming page: ```tsx // In src/components/Sidebar.tsx or similar import { VideoStreamingPage } from '../features/video-streaming'; const navigationItems = [ // ... existing items { name: 'Video Library', href: '/videos', icon: VideoCameraIcon, component: VideoStreamingPage, }, ]; ``` ### 2. Add Route (if using React Router) ```tsx // In your main App.tsx or router configuration import { VideoStreamingPage } from './features/video-streaming'; function App() { return ( {/* ... existing routes */} } /> ); } ``` ## 🧩 Using Individual Components The beauty of the modular architecture is that you can use individual components anywhere: ### Dashboard Home - Recent Videos ```tsx // In src/components/DashboardHome.tsx import { VideoList } from '../features/video-streaming'; export const DashboardHome = () => { return (
{/* Existing dashboard content */}

Recent Videos

); }; ``` ### Vision System - Camera Videos ```tsx // In src/components/VisionSystem.tsx import { VideoList, VideoCard } from '../features/video-streaming'; export const VisionSystem = () => { const [selectedCamera, setSelectedCamera] = useState(null); return (
{/* Existing vision system content */} {/* Add video section for selected camera */} {selectedCamera && (

Recent Videos - {selectedCamera}

)}
); }; ``` ### Experiment Data Entry - Video Evidence ```tsx // In src/components/DataEntry.tsx import { VideoThumbnail, VideoModal } from '../features/video-streaming'; export const DataEntry = () => { const [selectedVideo, setSelectedVideo] = useState(null); const [showVideoModal, setShowVideoModal] = useState(false); return (
{/* Existing form fields */} {/* Add video evidence section */}
{experimentVideos.map(video => ( { setSelectedVideo(video); setShowVideoModal(true); }} /> ))}
setShowVideoModal(false)} /> ); }; ``` ## 🎨 Customizing Components ### Custom Video Card for Experiments ```tsx // Create a specialized version for your use case import { VideoCard } from '../features/video-streaming'; export const ExperimentVideoCard = ({ video, experimentId, onAttach }) => { return (
{/* Add experiment-specific actions */}
); }; ``` ### Custom Video Player with Annotations ```tsx // Extend the base video player import { VideoPlayer } from '../features/video-streaming'; export const AnnotatedVideoPlayer = ({ fileId, annotations }) => { return (
{/* Add annotation overlay */}
{annotations.map(annotation => (
{annotation.text}
))}
); }; ``` ## 🔧 Configuration ### API Base URL Update the API base URL if needed: ```tsx // In your app configuration import { VideoApiService } from './features/video-streaming'; // Create a configured instance export const videoApi = new VideoApiService('http://your-api-server:8000'); // Or set globally process.env.REACT_APP_VIDEO_API_URL = 'http://your-api-server:8000'; ``` ### Custom Styling The components use Tailwind CSS classes. You can customize them: ```tsx // Override default styles ``` ## 🎯 Integration Examples ### 1. Camera Management Integration ```tsx // In your camera management page import { VideoList, useVideoList } from '../features/video-streaming'; export const CameraManagement = () => { const [selectedCamera, setSelectedCamera] = useState(null); const { videos } = useVideoList({ initialParams: { camera_name: selectedCamera?.name } }); return (
{/* Camera controls */} {/* Videos from selected camera */}

Videos from {selectedCamera?.name}

); }; ``` ### 2. Experiment Timeline Integration ```tsx // Show videos in experiment timeline import { VideoThumbnail } from '../features/video-streaming'; export const ExperimentTimeline = ({ experiment }) => { return (
{experiment.events.map(event => (

{event.title}

{event.description}

{/* Show related videos */} {event.videos?.length > 0 && (
{event.videos.map(videoId => ( ))}
)}
))}
); }; ``` ## 📱 Responsive Design The components are designed to be responsive: ```tsx // Automatic responsive grid // Mobile-friendly video player ``` ## 🔍 Search Integration Add search functionality: ```tsx import { useVideoList } from '../features/video-streaming'; export const VideoSearch = () => { const [searchTerm, setSearchTerm] = useState(''); const { videos, loading } = useVideoList({ initialParams: { search: searchTerm } }); return (
setSearchTerm(e.target.value)} placeholder="Search videos..." className="w-full px-4 py-2 border rounded-lg" />
); }; ``` ## 🚀 Next Steps 1. **Start Small**: Begin by adding the video library page 2. **Integrate Gradually**: Add individual components to existing pages 3. **Customize**: Create specialized versions for your specific needs 4. **Extend**: Add new features like annotations, bookmarks, or sharing The modular architecture makes it easy to start simple and grow the functionality over time!