- Clone the repo:
git clone https://github.com/mondyfy/hls_demo.git && cd hls_demo
- Install dependencies:
npm i
-
Add songs inside songs folder
-
Install ffmpeg on your system
sudo apt install ffmpeg
- Make temp/chunks folder
mkdir 'temp/chunks'
- Covert mp3 to chunks
node utils/mp3tohlschunks.js
- If you want to upload chunk files to s3 then add s3 credentials in utils/uploadchunkstos3.js and run:
node utils/uploadchunkstos3.js
Start the server with npm
npm run start
and request http://127.0.0.1:8000/0.m3u8 the manifest file will be downloaded, here to play the file you have to add one browser extension i.e. Native HLS Playback, that should play the media file you have used. In the meantime, you can inspect the file sequence chunks requested by the client/browser from the server after every 10 seconds the chunk has been loaded.