Search code examples
htmlnginxstreamhttp-live-streaming

How to setup HLS and DVR functionality and read it?


I want to create an audio stream live with the DVR functionality.

In my player I want to listen live or seek the past stream (few minutes ago).

I use nginx to serve the hls stream. How to setup the DVR functionality? Do I use a specific module in nginx for live stream and past stream with a param like past.m3u8?seek=timestamp

I'm also looking for a web player in html5 and fallback in flash to read the live stream and can seek the past.m3u8 stream.


Solution

  • I've setup nginx with this config:

        location /hls {
            # Serve HLS fragments
            types {
                application/vnd.apple.mpegurl m3u8;
                video/mp2t ts;
            }
            root /tmp;
            add_header Cache-Control no-cache;
        }
    

    I create hls stream with avconv.

        avconv -i [input] -vn -sn -c:a libfdk_aac -b:a 64k -hls_time 10 /path/to/hls/playlist.m3u8
    

    To read this stream I use clipr player who permits to seek the stream.