You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

225 lines
4.3 KiB

# Camera Platform-Specific Implementation
> **Agent role**:
Reference this file for platform-specific camera implementation details.
## Web Platform
### Implementation Details
- Uses `getUserMedia` API for camera access
- Implements fallback to file input if camera unavailable
- Handles browser compatibility issues
- Requires HTTPS for camera access
### Browser Support
- Chrome: Full support
- Firefox: Full support
- Safari: Limited support
- Edge: Full support
### Fallback Mechanisms
1. Camera access via getUserMedia
2. File input for image upload
3. Drag and drop support
4. Clipboard paste support
## Mobile Platform (Capacitor)
### iOS Implementation
- Uses `@capacitor-mlkit/barcode-scanning`
- Implements proper permission handling
- Supports both front and back cameras
- Handles camera switching
### Android Implementation
- Uses `@capacitor-mlkit/barcode-scanning`
- Implements proper permission handling
- Supports both front and back cameras
- Handles camera switching
### Permission Handling
- Camera permissions requested at runtime
- Permission state tracked and cached
- Graceful handling of denied permissions
- Clear user guidance for enabling permissions
## Desktop Platform (Electron)
### Current Status
- Camera implementation pending
- Will use platform-specific APIs
- Requires proper permission handling
- Will support both built-in and external cameras
### Planned Implementation
- Native camera access via Electron
- Platform-specific camera APIs
- Proper permission handling
- Camera switching support
## Platform Detection
### Implementation
- Uses `PlatformServiceFactory` for platform detection
- Implements platform-specific camera services
- Handles platform-specific error conditions
- Provides platform-specific user guidance
### Service Selection
- Web: `WebPlatformService`
- Mobile: `CapacitorPlatformService`
- Desktop: `ElectronPlatformService`
## Cross-Platform Compatibility
### Common Interface
- Unified camera service interface
- Platform-specific implementations
- Consistent error handling
- Unified user experience
### Feature Parity
- Core camera functionality across platforms
- Platform-specific optimizations
- Consistent user interface
- Unified error messages
## Platform-Specific Features
### Web
- Browser-based camera access
- File upload fallback
- Drag and drop support
- Clipboard paste support
### Mobile
- Native camera access
- Barcode scanning
- Photo capture
- Camera switching
### Desktop
- Native camera access (planned)
- External camera support (planned)
- Advanced camera controls (planned)
## Testing Strategy
### Platform Coverage
- Web: Multiple browsers
- Mobile: iOS and Android devices
- Desktop: Windows, macOS, Linux
### Test Scenarios
- Permission handling
- Camera access
- Error conditions
- Platform compatibility
- Performance metrics
---
**See also**:
- `.cursor/rules/features/camera-implementation.mdc` for
core implementation overview
- `.cursor/rules/features/camera_technical.mdc` for
technical implementation details
**Status**: Active platform-specific implementation guide
**Priority**: Medium
**Estimated Effort**: Ongoing reference
**Dependencies**: camera-implementation.mdc
**Stakeholders**: Development team, Platform team
## Model Implementation Checklist
### Before Camera Platform Implementation
- [ ] **Platform Analysis**: Identify target platforms and their camera capabilities
- [ ] **Feature Planning**: Plan platform-specific camera features
- [ ] **Integration Planning**: Plan integration with existing camera systems
- [ ] **Testing Strategy**: Plan testing across all target platforms
### During Camera Platform Implementation
- [ ] **Platform Services**: Implement platform-specific camera functionality
- [ ] **Feature Development**: Implement planned camera features for each platform
- [ ] **Integration**: Integrate with existing camera infrastructure
- [ ] **Performance Optimization**: Optimize camera performance for each platform
### After Camera Platform Implementation
- [ ] **Cross-Platform Testing**: Test camera functionality across all platforms
- [ ] **Feature Validation**: Verify all planned features work correctly
- [ ] **Performance Testing**: Ensure camera performance meets requirements
- [ ] **Documentation Update**: Update platform-specific camera documentation