Fix/direct http snapshot fetch #1535
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
♻️ Current situation
Currently, the plugin always uses FFmpeg to fetch camera snapshots, even when
stillImageSourceisa simple HTTP/HTTPS URL (e.g.,
http://192.168.1.100/snapshot.jpg). This approach has severalissues:
camera is missing '-i', it is likely misconfigured" when using valid HTTP URLs
Example of current behavior:
{ "stillImageSource": "http://192.168.1.100/snapshot.jpg" }💡 Proposed solution
Implement intelligent snapshot fetching that automatically detects the source type and uses the
optimal method:
Changes to src/streamingDelegate.ts
Changes to src/platform.ts
Documentation in CLAUDE.md
Detection is automatic and transparent - no configuration changes needed.
⚙️ Release Notes
Performance Improvements
Bug Fixes
URLs
Configuration Examples
HTTP URL snapshot (recommended for better performance):
✅ Direct HTTP fetch, no FFmpeg, no warning, much faster!
HTTPS URL snapshot:
✅ Direct HTTPS fetch with proper certificate handling
RTSP stream (still uses FFmpeg):
✅ FFmpeg-based fetching for video streams
Breaking Changes
None - This is fully backward compatible. All existing configurations work unchanged.
➕ Additional Information
Testing
Automated Tests:
Manual Testing Coverage:
Edge Cases Covered:
Edge Cases Not Applicable:
Reviewer Nudging
Good entry points:
- The fetchSnapshot() method now has the URL detection logic
- Look for the isDirectUrl check and the two branches
- Configuration validation logic
- Same regex pattern ensures consistency
- Documentation of the feature for future developers
Key Points to Review:
Performance Validation:
You can test the performance improvement by:
Before: ~100-500ms with FFmpeg
After: ~10-50ms with direct HTTP
Enable debug logging to see which method is used: