Streaming Video Implementation
This guide covers how to integrate Rhombus camera video streaming and media embedding capabilities into your applications. Whether you need real-time streaming, thumbnail previews, or recorded video playback, this implementation guide provides the tools and techniques you need.Overview
Rhombus cameras provide multiple ways to access video content:- Live streaming for real-time monitoring
- Thumbnail images for quick previews and dashboards
- Recorded video clips for historical playback
- Snapshot captures for specific moments
Getting Camera Thumbnails
All Rhombus cameras automatically upload thumbnail images that provide current snapshots of what the camera sees. These thumbnails are perfect for dashboard previews, monitoring interfaces, and quick status checks.Thumbnail Endpoint
Retrieve camera thumbnails using a GET request to:All
media.rhombussystems.com endpoints use the same authentication as the main API, so be sure to include the authentication headers!cameraUuid and mediaRegion for a camera, use the /camera/getMinimalCameraState endpoint to get a list of all cameras. In the response, you’ll find the uuid and mediaRegion fields.
Basic Implementation
Getting Frames at Specific Times
To get a JPEG image at a specified time, use the/video/getExactFrameUri endpoint to generate a frame URI. Execute a GET request to the returned frame URI with the same authentication headers to get the requested frame directly from the camera.
Live Video Streaming
Rhombus provides multiple ways to embed and stream live video content in your applications.Embedding Shared Streams as iframes (Recommended)
The most common and recommended way is to use iframes to embed the Rhombus video player directly in your site. This comes with the added benefit that camera events and analytics are pulled automatically into the player. You will need to create shared streams for each camera that you want to embed. This can be done in the console, or from the API using the/api/camera/createSharedLiveVideoStream endpoint.
React Component Example
Here’s a React component for embedding shared streams:URL Parameters for Enhanced Control
You can customize the embedded player using URL parameters. All parameters can be set totrue or false:
| Parameter | Description |
|---|---|
disableautoplay | Enable or disable video autoplay upon loading |
hideevents | Enable or disable the timeline and related events |
realtime | Enable or disable real-time streaming by default |
showheader | Enable or disable zoom & streaming buttons at the top |
showfooter | Enable or disable camera name and timestamp at bottom |
lowRes | Force low resolution on the video stream |
performanceMode | Force performance mode allowing GPU usage |
t | Timestamp (epoch milliseconds) where video should start |
Parameter Usage
Follow this structure:https://{{url}}/?{{variable}}=true&{{variable}}=false
Example:
React Usage with Parameters
Accessing Raw MPEG-DASH Streams
With API authentication, you can also access the raw MPEG-DASH stream for use with any standard player. To keep the API token secure and resolve CORS issues, we recommend using a server middleman that acts as a proxy.Recorded Video Playback
Access recorded video clips for historical analysis and review.Downloading VOD Clips as MP4s
You can download Video on Demand (VOD) footage directly from a camera by specifying the start time and duration to access footage.Python Example for VOD Download
Downloading Alert Clips
You can download clips corresponding to specific alerts. This is particularly useful when using webhooks to be triggered whenever an alert is created in the system.Getting Alert Details for Clip Download
If you’re using the API to get alert details (e.g.,/api/event/getPolicyAlertsV2), you can use the response fields to construct the media request:
Complete Implementation Examples
Multi-Purpose React Component
Here’s a comprehensive React component that supports thumbnails, shared streams, and video downloads:Usage Examples
Best Practices
Performance Optimization
- Thumbnail Caching: Implement client-side caching for thumbnails to reduce API calls
- Lazy Loading: Load video content only when needed or when in viewport
- Quality Selection: Choose appropriate quality settings based on use case and bandwidth
- Connection Pooling: Reuse connections for multiple API requests
Security Considerations
- API Key Management: Store API keys securely and never expose them in client-side code
- HTTPS Only: Always use HTTPS for all API communications
- Token Rotation: Implement regular API key rotation
- Access Control: Limit camera access based on user permissions
Error Handling
Accessibility
Ensure your video implementations are accessible to all users:Troubleshooting
Common Issues
Thumbnail Not Loading- Verify camera UUID is correct
- Check API key permissions
- Ensure camera is online and accessible
- Check network connectivity
- Verify WebRTC/HLS support in browser
- Review firewall and proxy settings
- Adjust quality parameters
- Check available bandwidth
- Consider using adaptive bitrate streaming