feat(streaming): Add live streaming functionality for USDA Vision Camera system

- Introduced non-blocking live preview streaming that operates independently from recording.
- Implemented REST API endpoints for starting and stopping streams, and retrieving live streams.
- Developed a web interface (`camera_preview.html`) for users to control and view camera streams.
- Created TypeScript definitions for API integration in React projects.
- Added comprehensive testing script (`test_streaming.py`) to validate API endpoints and concurrent operations.
- Updated database migration to fix visibility of experiment repetitions for all authenticated users.
This commit is contained in:
Alireza Vaezi
2025-07-28 17:53:59 -04:00
parent d598281164
commit 104f6202fb
10 changed files with 2410 additions and 421 deletions

View File

@@ -85,15 +85,11 @@ CREATE TRIGGER trigger_experiment_repetitions_updated_at
ALTER TABLE public.experiment_repetitions ENABLE ROW LEVEL SECURITY;
-- Create RLS policies for experiment_repetitions
-- Users can view repetitions for experiments they have access to
-- All authenticated users can view all experiment repetitions
CREATE POLICY "Users can view experiment repetitions" ON public.experiment_repetitions
FOR SELECT USING (
experiment_id IN (
SELECT id FROM public.experiments
WHERE created_by = auth.uid()
)
OR public.is_admin()
);
FOR SELECT
TO authenticated
USING (true);
-- Users can insert repetitions for experiments they created or if they're admin
CREATE POLICY "Users can create experiment repetitions" ON public.experiment_repetitions

View File

@@ -0,0 +1,12 @@
-- Fix experiment repetitions visibility for all users
-- This migration updates the RLS policy to allow all authenticated users to view all experiment repetitions
-- Previously, users could only see repetitions for experiments they created
-- Drop the existing restrictive policy
DROP POLICY IF EXISTS "Users can view experiment repetitions" ON public.experiment_repetitions;
-- Create new policy that allows all authenticated users to view all repetitions
CREATE POLICY "Users can view experiment repetitions" ON public.experiment_repetitions
FOR SELECT
TO authenticated
USING (true);