Home

Awesome

Example-HLS-Media-Stream Build Status

Example project how-to build HLS-streaming server using oat++ (AKA oatpp) Async API.

Live stream is tested with Safari-Browser and VLC-player

See more:

Overview

Server generates infinite .m3u8 playlist from the pre-generated playlist_live.m3u8 file in the video folder.
File video/playlist_live.m3u8 together with video chunks is generated using ffmpeg.

Server is built using oat++ Async-Api and has following endpoints:

Project layout


|- CMakeLists.txt                       // projects CMakeLists.txt
|- src/                                 // source folder
|- test/                                // test folder
|- utility/install-oatpp-modules.sh     // utility script to install required oatpp-modules.
|
|- video/                               // media files and playlists here
     |- generate_pls.sh                 // example how to use ```ffmpeg``` to generate initial playlist and video chunks
     |- playlist_live.m3u8              // playlist used to generate infinite playlist for http-live-streaming

- src/
    |
    |- controller/              // Folder containing UserController where all endpoints are declared
    |- hls/                     // Playlist generator is here
    |- Utils.hpp                // Utils
    |- AppComponent.hpp         // Service config
    |- App.cpp                  // main() is here
    

Build and Run

Using CMake

Requires

$ mkdir build && cd build
$ cmake ..
$ make 
$ ./hls-example-exe             # - run application.

In Docker

$ docker build -t example-hls .
$ docker run -p 8000:8000 -t example-hls

Screenshots

<img src="https://github.com/oatpp/example-hls-media-stream/blob/master/screenshots/screen-2.png" width="33%"><img src="https://github.com/oatpp/example-hls-media-stream/blob/master/screenshots/screen-3.png" width="33%"><img src="https://github.com/oatpp/example-hls-media-stream/blob/master/screenshots/screen-4.png" width="33%">


Notes

Urls

Files

Note

If app can't find playlist of video files then specify full-file-paths for {repo}/video/playlist_live.m3u8 file and {repo}/video folder in AppComponent.hpp