WebRTC Video Stream
Who it’s for
Security managers, drone operators, and robotics teams ask “what is this device seeing right now, with as little delay as possible?” They need sub-second latency for remote control, incident response, or real-time inspection where the 6–30 second delay of an HLS stream is operationally unacceptable.
What it does
A camera publishing a WHEP endpoint at https://media.example.com/camera1/whep plays live in the dashboard with typical glass-to-glass latency under one second. The widget uses the browser’s native RTCPeerConnection — no plugins required. The trade-off versus HLS is live-only: there is no seeking or VOD playback.
- Sub-second live video via WHEP signaling over the browser’s native WebRTC stack
- STUN server support for NAT traversal when the browser and media server are on different networks
- Pulsing LIVE indicator that can be toggled on to make the real-time nature of the feed visible to operators
- Fallback URL for when the attribute is empty or the device is offline
- Shows one stream per widget; add multiple widgets to monitor several cameras simultaneously
How to set up
Data keys
| Key | Role | Type | Description |
|---|---|---|---|
webrtcStreamUrl | Stream URL | Attribute | The WHEP endpoint URL to connect to; change the key name to match your device’s attribute key |
The widget ships with a function datasource key labeled webrtcStreamUrl that returns the placeholder endpoint http://localhost:8889/camera1/whep, so nothing plays until you point the datasource at your device’s own attribute.
To point it at your own device: open the dashboard in edit mode, open the widget’s Datasources, pick the entity or entity alias, and replace the function key with the key your device reports.
If the attribute is empty and no fallback URL is configured, the player shows a blank state.
How to customize
- To set a fallback stream — enter a Fallback stream URL in the Video streaming settings; this plays when the data key returns an empty value.
- To configure NAT traversal — set STUN server URL to your STUN/TURN server (e.g.
stun:stun.l.google.com:19302) when the browser and media server are separated by NAT. - To show a LIVE badge — toggle Show LIVE indicator in the Video streaming settings to display a pulsing badge that confirms the stream is real-time.
- To control autoplay and mute — toggle Autoplay and Start muted; browsers typically require muted start for autoplay to work.
- To show or hide player controls — toggle Show video controls in the Video streaming settings.
Tips
- WebRTC requires the media server to support WHEP signaling; if your camera or streaming server only outputs RTSP or HLS, use an intermediary such as MediaMTX or mediasoup to re-publish as WHEP before connecting this widget.
- If the stream fails to connect through a corporate firewall, add a TURN relay server in the STUN server URL field — STUN alone cannot traverse symmetric NAT, but a TURN server can.
- Use this widget instead of the HLS stream widget whenever the use case involves real-time human reaction: remote pan-tilt-zoom control, robot teleoperation, or live security monitoring where a 10-second delay means missing an event.
Share Your Widget with the Community
Built a custom widget? Export it as a JSON from ThingsBoard and publish it to the IoT Hub through a simple 4-step wizard (Upload, Listing, Readme, Review & Submit). Share it with thousands of ThingsBoard developers worldwide and get featured in the catalog.