mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
4.0 KiB
4.0 KiB
Daily.co Migration Implementation Status
Completed Components
1. Platform Abstraction Layer (server/reflector/video_platforms/)
- base.py: Abstract interface defining all platform operations
- whereby.py: Whereby implementation wrapping existing functionality
- daily.py: Daily.co client implementation (ready for testing when credentials available)
- mock.py: Mock implementation for unit testing
- registry.py: Platform registration and discovery
- factory.py: Factory methods for creating platform clients
2. Database Updates
- Models: Added
platformfield to Room and Meeting tables - Migration: Created migration
20250801180012_add_platform_support.py - Controllers: Updated to handle platform field
3. Configuration
- Settings: Added Daily.co configuration variables
- Feature Flags:
DAILY_MIGRATION_ENABLED: Master switch for migrationDAILY_MIGRATION_ROOM_IDS: List of specific rooms to migrateDEFAULT_VIDEO_PLATFORM: Default platform when migration enabled
4. Backend API Updates
- Room Creation: Now assigns platform based on feature flags
- Meeting Creation: Uses platform abstraction instead of direct Whereby calls
- Response Models: Include platform field
- Webhook Handler: Added Daily.co webhook endpoint at
/v1/daily_webhook
5. Frontend Components (www/app/[roomName]/components/)
- RoomContainer.tsx: Platform-agnostic container that routes to appropriate component
- WherebyRoom.tsx: Extracted existing Whereby functionality with consent management
- DailyRoom.tsx: Daily.co implementation using DailyIframe
- Dependencies: Added
@daily-co/daily-jsand@daily-co/daily-react
How It Works
-
Platform Selection:
- If
DAILY_MIGRATION_ENABLED=false→ Always use Whereby - If enabled and room ID in
DAILY_MIGRATION_ROOM_IDS→ Use Daily - Otherwise → Use
DEFAULT_VIDEO_PLATFORM
- If
-
Meeting Creation Flow:
platform = get_platform_for_room(room.id) client = create_platform_client(platform) meeting_data = await client.create_meeting(...) -
Testing Without Credentials:
- Use
platform="mock"in tests - Mock client simulates all operations
- No external API calls needed
- Use
Next Steps
When Daily.co Credentials Available:
-
Set Environment Variables:
DAILY_API_KEY=your-key DAILY_WEBHOOK_SECRET=your-secret DAILY_SUBDOMAIN=your-subdomain AWS_DAILY_S3_BUCKET=your-bucket AWS_DAILY_ROLE_ARN=your-role -
Run Database Migration:
cd server uv run alembic upgrade head -
Test Platform Creation:
from reflector.video_platforms.factory import create_platform_client client = create_platform_client("daily") # Test operations...
Remaining Implementation Tasks:
-
Webhook Handlers:
- Create
/v1/daily_webhookendpoint - Map Daily.co events to database updates
- Handle recording notifications
- Create
-
Frontend Updates:
- Create DailyRoom component
- Implement platform detection
- Update consent flow
-
Testing:
- Unit tests with mock platform
- Integration tests with real APIs
- Migration rollback tests
Testing the Current Implementation
Without Daily.co credentials, you can test using the mock:
from reflector.video_platforms.factory import create_platform_client
from reflector.video_platforms.base import VideoPlatformConfig
# Create mock client
config = VideoPlatformConfig(
api_key="test",
webhook_secret="test"
)
client = create_platform_client("mock")
# Test operations
meeting = await client.create_meeting(
room_name_prefix="test",
end_date=datetime.utcnow() + timedelta(hours=1),
room=room
)
Architecture Benefits
- Testable: Mock implementation allows testing without external dependencies
- Extensible: Easy to add new platforms (Zoom, Teams, etc.)
- Gradual Migration: Feature flags enable room-by-room migration
- Rollback Ready: Can disable Daily.co instantly via feature flag