Overview
Joystick uses MediaMTX as its streaming server, providing support for multiple protocols including RTSP, RTMP, HLS, WebRTC, and SRT. MediaMTX runs as a core service in the platform’s Docker stack.MediaMTX service
MediaMTX is deployed using the official Docker image:docker-compose.yml
MediaMTX runs in
host network mode to avoid port mapping complexity for UDP-based protocols like RTP and WebRTC.Configuration
MediaMTX is configured viamediamtx.yml. Here are the key settings:
Control API
The API enables programmatic stream management:mediamtx/mediamtx.yml
Enables the REST API for stream control
API server listen address
CORS header for cross-origin requests
Streaming protocols
MediaMTX supports multiple protocols simultaneously:Protocol configuration
Protocol configuration
- RTSP
- WebRTC
- HLS
- RTMP
- SRT
Real-Time Streaming Protocol for device sources:
Supported transports:
udp, multicast, tcpStream paths
Streams are organized by path, which acts as a unique identifier:Path configuration
Default settings apply to all paths unless overridden:mediamtx/mediamtx.yml
Path settings
Path settings
Stream source. Can be:
publisher- Client publishes to this pathrtsp://url- Pull from RTSP camerartmp://url- Pull from RTMP sourcehttp://url/stream.m3u8- Pull from HLS sourceredirect- Redirect to another path
Only pull source when readers connect (saves bandwidth)
Maximum concurrent readers (0 = unlimited)
Allow new publisher to disconnect existing publisher
Custom path example
Authentication
MediaMTX supports multiple authentication methods:Internal authentication
Defined in the configuration file:mediamtx/mediamtx.yml
HTTP authentication
External authentication via HTTP callback:JWT authentication
Token-based authentication:Recording
MediaMTX can record streams to disk:API integration
Joystick services interact with MediaMTX via its REST API:Environment configuration
docker-compose.yml
API endpoints
- List paths
- Add path
- Remove path
- Get path info
Action integration
Actions can configure streams using the$mediamtx parameter:
Device streaming
Devices typically publish streams to MediaMTX via RTSP:Publishing from device
Playback URLs
Once published, streams are accessible via multiple protocols:Stream quality presets
Device models can define quality presets:packages/core/src/types/index.ts
Troubleshooting
Stream not appearing
Stream not appearing
- Check MediaMTX logs:
- Verify path is registered:
- Test publisher connection:
WebRTC connection fails
WebRTC connection fails
- Ensure
webrtcIPsFromInterfaces: yesis set - Check firewall rules for UDP port 8189
- Verify STUN/TURN server configuration if behind NAT
- Test with browser console for WebRTC errors
High latency
High latency
- Use WebRTC instead of HLS for lowest latency
- Reduce HLS segment duration:
- Use TCP transport for RTSP to avoid packet loss:
Recording not working
Recording not working
- Verify record is enabled for the path
- Check disk space availability
- Ensure recording directory has write permissions
- Check
recordPathtemplate syntax
Related resources
MediaMTX Documentation
Official MediaMTX documentation
Devices
Configure device streaming sources
Actions
Control streams with actions