HLS & Low-Latency Live Streaming
RUSEON Core features an in-memory HTTP Live Streaming (HLS) transmuxer that packages incoming RTSP video frames into standard MPEG-TS segments on the fly, delivering video to web browsers, mobile apps, and smart TVs with zero disk I/O.
1. HLS Endpoint Specifications
| Endpoint | Method | Response Type | Description |
|---|---|---|---|
/stream/hls/{id}/index.m3u8 | GET | application/vnd.apple.mpegurl | Multi-variant master playlist linking video and subtitle tracks |
/stream/hls/{id}/stream.m3u8 | GET | application/vnd.apple.mpegurl | Media playlist listing live sliding-window chunks held in RAM |
/stream/hls/{id}/subs.m3u8 | GET | application/vnd.apple.mpegurl | Synchronized WebVTT subtitle track containing AI detections |
/stream/hls/{id}/{segment} | GET | video/MP2T | Virtual MPEG-TS video segment served directly from RAM |
2. Web Player Integration (HLS.js Example)
Integrate live HLS video playback into web pages using Hls.js:
html
<!DOCTYPE html>
<html>
<head>
<title>RUSEON HLS Live Stream</title>
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
</head>
<body>
<video id="video" controls autoplay muted style="width: 100%; max-width: 960px;"></video>
<script>
const video = document.getElementById('video');
const videoSrc = 'http://localhost:8080/stream/hls/cam-01/index.m3u8';
if (Hls.isSupported()) {
const hls = new Hls({
liveSyncDurationCount: 3,
maxBufferLength: 10
});
hls.loadSource(videoSrc);
hls.attachMedia(video);
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
// Native Apple Safari HLS support
video.src = videoSrc;
}
</script>
</body>
</html>3. Configuration in config.yaml
yaml
server:
hls:
live_segments_in_memory: 3 # In-memory buffer size (default: 3 segments)
cameras:
- id: "cam-01"
url: "rtsp://admin:pass@192.168.1.100:554/live"
lazy_hls: true # Generate HLS only when viewers are active